diff --git a/.changeset/tiny-wolves-battle.md b/.changeset/tiny-wolves-battle.md
new file mode 100644
index 00000000000..54e1780941e
--- /dev/null
+++ b/.changeset/tiny-wolves-battle.md
@@ -0,0 +1,7 @@
+---
+'@clerk/localizations': patch
+'@clerk/clerk-js': patch
+'@clerk/types': patch
+---
+
+Add `Pay with test card` button on `` component in dev instance
diff --git a/packages/clerk-js/bundlewatch.config.json b/packages/clerk-js/bundlewatch.config.json
index baab3fe9030..09f6fd140cf 100644
--- a/packages/clerk-js/bundlewatch.config.json
+++ b/packages/clerk-js/bundlewatch.config.json
@@ -21,8 +21,8 @@
{ "path": "./dist/waitlist*.js", "maxSize": "1.3KB" },
{ "path": "./dist/keylessPrompt*.js", "maxSize": "6.5KB" },
{ "path": "./dist/pricingTable*.js", "maxSize": "4.02KB" },
- { "path": "./dist/checkout*.js", "maxSize": "5.75KB" },
- { "path": "./dist/paymentSources*.js", "maxSize": "8.9KB" },
+ { "path": "./dist/checkout*.js", "maxSize": "5.79KB" },
+ { "path": "./dist/paymentSources*.js", "maxSize": "9.06KB" },
{ "path": "./dist/up-billing-page*.js", "maxSize": "2.4KB" },
{ "path": "./dist/op-billing-page*.js", "maxSize": "2.4KB" },
{ "path": "./dist/sessionTasks*.js", "maxSize": "1KB" }
diff --git a/packages/clerk-js/src/ui/components/Checkout/CheckoutComplete.tsx b/packages/clerk-js/src/ui/components/Checkout/CheckoutComplete.tsx
index d1f29af89b8..2f3d916e693 100644
--- a/packages/clerk-js/src/ui/components/Checkout/CheckoutComplete.tsx
+++ b/packages/clerk-js/src/ui/components/Checkout/CheckoutComplete.tsx
@@ -257,7 +257,9 @@ export const CheckoutComplete = ({
text={
checkout.totals.totalDueNow.amount > 0
? checkout.paymentSource
- ? `${capitalize(checkout.paymentSource.cardType)} ⋯ ${checkout.paymentSource.last4}`
+ ? checkout.paymentSource.paymentMethod !== 'card'
+ ? `${capitalize(checkout.paymentSource.paymentMethod)}`
+ : `${capitalize(checkout.paymentSource.cardType)} ⋯ ${checkout.paymentSource.last4}`
: '–'
: checkout.subscription?.periodStart
? formatDate(new Date(checkout.subscription.periodStart))
diff --git a/packages/clerk-js/src/ui/components/Checkout/CheckoutForm.tsx b/packages/clerk-js/src/ui/components/Checkout/CheckoutForm.tsx
index b7be35a3351..2f5eab35547 100644
--- a/packages/clerk-js/src/ui/components/Checkout/CheckoutForm.tsx
+++ b/packages/clerk-js/src/ui/components/Checkout/CheckoutForm.tsx
@@ -169,6 +169,20 @@ const CheckoutFormElements = ({
setIsSubmitting(false);
};
+ const onPayWithTestPaymentSourceSuccess = async () => {
+ try {
+ const newCheckout = await checkout.confirm({
+ gateway: 'stripe',
+ useTestCard: true,
+ ...(subscriberType === 'org' ? { orgId: organization?.id } : {}),
+ });
+ onCheckoutComplete(newCheckout);
+ void revalidatePaymentSources();
+ } catch (error) {
+ handleError(error, [], setSubmitError);
+ }
+ };
+
return (
0
@@ -225,6 +240,7 @@ const CheckoutFormElements = ({
}
submitError={submitError}
setSubmitError={setSubmitError}
+ showPayWithTestCardSection
/>
)}
@@ -252,9 +268,14 @@ const ExistingPaymentSourceForm = ({
const options = useMemo(() => {
return paymentSources.map(source => {
+ const label =
+ source.paymentMethod !== 'card'
+ ? `${capitalize(source.paymentMethod)}`
+ : `${capitalize(source.cardType)} ⋯ ${source.last4}`;
+
return {
value: source.id,
- label: `${capitalize(source.cardType)} ⋯ ${source.last4}`,
+ label,
};
});
}, [paymentSources]);
diff --git a/packages/clerk-js/src/ui/components/PaymentSources/AddPaymentSource.tsx b/packages/clerk-js/src/ui/components/PaymentSources/AddPaymentSource.tsx
index 7d14576de16..7a21331b9c4 100644
--- a/packages/clerk-js/src/ui/components/PaymentSources/AddPaymentSource.tsx
+++ b/packages/clerk-js/src/ui/components/PaymentSources/AddPaymentSource.tsx
@@ -7,7 +7,7 @@ import { useEffect, useRef, useState } from 'react';
import { clerkUnsupportedEnvironmentWarning } from '../../../core/errors';
import { useEnvironment, useSubscriberTypeContext } from '../../contexts';
-import { Box, descriptors, Flex, localizationKeys, Spinner, Text, useAppearance } from '../../customizables';
+import { Box, Button, descriptors, Flex, localizationKeys, Spinner, Text, useAppearance } from '../../customizables';
import { Alert, Form, FormButtons, FormContainer, LineItems, withCardStateProvider } from '../../elements';
import { useFetch } from '../../hooks/useFetch';
import type { LocalizationKey } from '../../localization';
@@ -22,10 +22,21 @@ type AddPaymentSourceProps = {
submitError?: ClerkRuntimeError | ClerkAPIError | string | undefined;
setSubmitError?: (submitError: ClerkRuntimeError | ClerkAPIError | string | undefined) => void;
resetStripeElements?: () => void;
+ onPayWithTestPaymentSourceSuccess?: () => void;
+ showPayWithTestCardSection?: boolean;
};
export const AddPaymentSource = (props: AddPaymentSourceProps) => {
- const { checkout, submitLabel, onSuccess, cancelAction, submitError, setSubmitError } = props;
+ const {
+ checkout,
+ submitLabel,
+ onSuccess,
+ cancelAction,
+ submitError,
+ setSubmitError,
+ onPayWithTestPaymentSourceSuccess,
+ showPayWithTestCardSection,
+ } = props;
const { __experimental_commerce } = useClerk();
const { __experimental_commerceSettings } = useEnvironment();
const { organization } = useOrganization();
@@ -137,6 +148,8 @@ export const AddPaymentSource = (props: AddPaymentSourceProps) => {
submitError={submitError}
setSubmitError={setSubmitError}
resetStripeElements={resetStripeElements}
+ onPayWithTestPaymentSourceSuccess={onPayWithTestPaymentSourceSuccess}
+ showPayWithTestCardSection={showPayWithTestCardSection}
/>
);
@@ -151,6 +164,8 @@ const AddPaymentSourceForm = withCardStateProvider(
submitError,
setSubmitError,
resetStripeElements,
+ onPayWithTestPaymentSourceSuccess,
+ showPayWithTestCardSection,
}: AddPaymentSourceProps) => {
const clerk = useClerk();
const stripe = useStripe();
@@ -218,68 +233,72 @@ const AddPaymentSourceForm = withCardStateProvider(
rowGap: t.space.$3,
})}
>
- {clerk.instanceType === 'development' && (
- ({
- background: t.colors.$neutralAlpha50,
- padding: t.space.$2x5,
- borderRadius: t.radii.$md,
- borderWidth: t.borderWidths.$normal,
- borderStyle: t.borderStyles.$solid,
- borderColor: t.colors.$neutralAlpha100,
- display: 'flex',
- flexDirection: 'column',
- rowGap: t.space.$2,
- position: 'relative',
- })}
- >
+ {showPayWithTestCardSection ? (
+
+ ) : (
+ clerk.instanceType === 'development' && (
({
- position: 'absolute',
- inset: 0,
- background: `repeating-linear-gradient(-45deg,${t.colors.$warningAlpha100},${t.colors.$warningAlpha100} 6px,${t.colors.$warningAlpha150} 6px,${t.colors.$warningAlpha150} 12px)`,
- maskImage: `linear-gradient(transparent 20%, black)`,
- pointerEvents: 'none',
- })}
- />
-
-
- Test card information
-
- ({
- color: t.colors.$warning500,
- fontWeight: t.fontWeights.$semibold,
+ position: 'absolute',
+ inset: 0,
+ background: `repeating-linear-gradient(-45deg,${t.colors.$warningAlpha100},${t.colors.$warningAlpha100} 6px,${t.colors.$warningAlpha150} 6px,${t.colors.$warningAlpha150} 12px)`,
+ maskImage: `linear-gradient(transparent 20%, black)`,
+ pointerEvents: 'none',
})}
+ />
+
- Development mode
-
+
+ Test card information
+
+ ({
+ color: t.colors.$warning500,
+ fontWeight: t.fontWeights.$semibold,
+ })}
+ >
+ Development mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ )
)}
void }) => {
+ const clerk = useClerk();
+ const [isSubmitting, setIsSubmitting] = useState(false);
+
+ const onPaymentSourceSubmit = (e: React.FormEvent) => {
+ e.preventDefault();
+ setIsSubmitting(true);
+
+ onCheckoutComplete?.();
+ };
+
+ if (clerk.instanceType !== 'development') {
+ return null;
+ }
+
+ return (
+ ({
+ background: t.colors.$neutralAlpha50,
+ padding: t.space.$2x5,
+ borderRadius: t.radii.$md,
+ borderWidth: t.borderWidths.$normal,
+ borderStyle: t.borderStyles.$solid,
+ borderColor: t.colors.$neutralAlpha100,
+ display: 'flex',
+ flexDirection: 'column',
+ rowGap: t.space.$2,
+ position: 'relative',
+ })}
+ >
+ ({
+ position: 'absolute',
+ inset: 0,
+ background: `repeating-linear-gradient(-45deg,${t.colors.$warningAlpha100},${t.colors.$warningAlpha100} 6px,${t.colors.$warningAlpha150} 6px,${t.colors.$warningAlpha150} 12px)`,
+ maskImage: `linear-gradient(transparent 20%, black)`,
+ pointerEvents: 'none',
+ })}
+ />
+ ({
+ alignItems: 'center',
+ justifyContent: 'center',
+ flexDirection: 'column',
+ rowGap: t.space.$2,
+ })}
+ >
+ ({
+ color: t.colors.$warning500,
+ fontWeight: t.fontWeights.$semibold,
+ })}
+ >
+ Development mode
+
+
+
+
+ );
+ },
+);
diff --git a/packages/localizations/src/ar-SA.ts b/packages/localizations/src/ar-SA.ts
index 457999b0b84..ecbb0eaecfa 100644
--- a/packages/localizations/src/ar-SA.ts
+++ b/packages/localizations/src/ar-SA.ts
@@ -704,6 +704,7 @@ export const arSA: LocalizationResource = {
cancelButton: undefined,
formButtonPrimary__add: undefined,
formButtonPrimary__pay: undefined,
+ payWithTestCardButton: undefined,
removeResource: {
messageLine1: undefined,
messageLine2: undefined,
diff --git a/packages/localizations/src/be-BY.ts b/packages/localizations/src/be-BY.ts
index 76943d46830..706b62e25ca 100644
--- a/packages/localizations/src/be-BY.ts
+++ b/packages/localizations/src/be-BY.ts
@@ -712,6 +712,7 @@ export const beBY: LocalizationResource = {
cancelButton: undefined,
formButtonPrimary__add: undefined,
formButtonPrimary__pay: undefined,
+ payWithTestCardButton: undefined,
removeResource: {
messageLine1: undefined,
messageLine2: undefined,
diff --git a/packages/localizations/src/bg-BG.ts b/packages/localizations/src/bg-BG.ts
index 06fd4fee0fa..303083604f2 100644
--- a/packages/localizations/src/bg-BG.ts
+++ b/packages/localizations/src/bg-BG.ts
@@ -703,6 +703,7 @@ export const bgBG: LocalizationResource = {
cancelButton: undefined,
formButtonPrimary__add: undefined,
formButtonPrimary__pay: undefined,
+ payWithTestCardButton: undefined,
removeResource: {
messageLine1: undefined,
messageLine2: undefined,
diff --git a/packages/localizations/src/ca-ES.ts b/packages/localizations/src/ca-ES.ts
index a770de0d2e6..a024955ea60 100644
--- a/packages/localizations/src/ca-ES.ts
+++ b/packages/localizations/src/ca-ES.ts
@@ -707,6 +707,7 @@ export const caES: LocalizationResource = {
cancelButton: undefined,
formButtonPrimary__add: undefined,
formButtonPrimary__pay: undefined,
+ payWithTestCardButton: undefined,
removeResource: {
messageLine1: undefined,
messageLine2: undefined,
diff --git a/packages/localizations/src/cs-CZ.ts b/packages/localizations/src/cs-CZ.ts
index 2cd81afabc5..2855a99b6f5 100644
--- a/packages/localizations/src/cs-CZ.ts
+++ b/packages/localizations/src/cs-CZ.ts
@@ -703,6 +703,7 @@ export const csCZ: LocalizationResource = {
cancelButton: undefined,
formButtonPrimary__add: undefined,
formButtonPrimary__pay: undefined,
+ payWithTestCardButton: undefined,
removeResource: {
messageLine1: undefined,
messageLine2: undefined,
diff --git a/packages/localizations/src/da-DK.ts b/packages/localizations/src/da-DK.ts
index 32d42eb6d25..099b91d586a 100644
--- a/packages/localizations/src/da-DK.ts
+++ b/packages/localizations/src/da-DK.ts
@@ -704,6 +704,7 @@ export const daDK: LocalizationResource = {
cancelButton: undefined,
formButtonPrimary__add: undefined,
formButtonPrimary__pay: undefined,
+ payWithTestCardButton: undefined,
removeResource: {
messageLine1: undefined,
messageLine2: undefined,
diff --git a/packages/localizations/src/de-DE.ts b/packages/localizations/src/de-DE.ts
index 42dde4cba13..5e1899bb743 100644
--- a/packages/localizations/src/de-DE.ts
+++ b/packages/localizations/src/de-DE.ts
@@ -722,6 +722,7 @@ export const deDE: LocalizationResource = {
cancelButton: undefined,
formButtonPrimary__add: undefined,
formButtonPrimary__pay: undefined,
+ payWithTestCardButton: undefined,
removeResource: {
messageLine1: undefined,
messageLine2: undefined,
diff --git a/packages/localizations/src/el-GR.ts b/packages/localizations/src/el-GR.ts
index 6703a8f359f..8116bdc424a 100644
--- a/packages/localizations/src/el-GR.ts
+++ b/packages/localizations/src/el-GR.ts
@@ -712,6 +712,7 @@ export const elGR: LocalizationResource = {
cancelButton: undefined,
formButtonPrimary__add: undefined,
formButtonPrimary__pay: undefined,
+ payWithTestCardButton: undefined,
removeResource: {
messageLine1: undefined,
messageLine2: undefined,
diff --git a/packages/localizations/src/en-GB.ts b/packages/localizations/src/en-GB.ts
index f0b7b7859fd..f5d3fcce52f 100644
--- a/packages/localizations/src/en-GB.ts
+++ b/packages/localizations/src/en-GB.ts
@@ -712,6 +712,7 @@ export const enGB: LocalizationResource = {
cancelButton: undefined,
formButtonPrimary__add: undefined,
formButtonPrimary__pay: undefined,
+ payWithTestCardButton: undefined,
removeResource: {
messageLine1: undefined,
messageLine2: undefined,
diff --git a/packages/localizations/src/en-US.ts b/packages/localizations/src/en-US.ts
index f4bbe058a71..e0b029341ad 100644
--- a/packages/localizations/src/en-US.ts
+++ b/packages/localizations/src/en-US.ts
@@ -701,6 +701,7 @@ export const enUS: LocalizationResource = {
cancelButton: 'Cancel',
formButtonPrimary__add: 'Add Payment Method',
formButtonPrimary__pay: 'Pay {{amount}}',
+ payWithTestCardButton: 'Pay with test card',
removeResource: {
messageLine1: '{{identifier}} will be removed from this account.',
messageLine2:
diff --git a/packages/localizations/src/es-ES.ts b/packages/localizations/src/es-ES.ts
index 1c6591d9cd4..c03f1cbaa09 100644
--- a/packages/localizations/src/es-ES.ts
+++ b/packages/localizations/src/es-ES.ts
@@ -709,6 +709,7 @@ export const esES: LocalizationResource = {
cancelButton: undefined,
formButtonPrimary__add: undefined,
formButtonPrimary__pay: undefined,
+ payWithTestCardButton: undefined,
removeResource: {
messageLine1: undefined,
messageLine2: undefined,
diff --git a/packages/localizations/src/es-MX.ts b/packages/localizations/src/es-MX.ts
index 3aa2fe2dbeb..28435c51de2 100644
--- a/packages/localizations/src/es-MX.ts
+++ b/packages/localizations/src/es-MX.ts
@@ -710,6 +710,7 @@ export const esMX: LocalizationResource = {
cancelButton: undefined,
formButtonPrimary__add: undefined,
formButtonPrimary__pay: undefined,
+ payWithTestCardButton: undefined,
removeResource: {
messageLine1: undefined,
messageLine2: undefined,
diff --git a/packages/localizations/src/fi-FI.ts b/packages/localizations/src/fi-FI.ts
index 6c23737454e..0d916484a61 100644
--- a/packages/localizations/src/fi-FI.ts
+++ b/packages/localizations/src/fi-FI.ts
@@ -707,6 +707,7 @@ export const fiFI: LocalizationResource = {
cancelButton: undefined,
formButtonPrimary__add: undefined,
formButtonPrimary__pay: undefined,
+ payWithTestCardButton: undefined,
removeResource: {
messageLine1: undefined,
messageLine2: undefined,
diff --git a/packages/localizations/src/fr-FR.ts b/packages/localizations/src/fr-FR.ts
index bedc4884fb8..249dab95987 100644
--- a/packages/localizations/src/fr-FR.ts
+++ b/packages/localizations/src/fr-FR.ts
@@ -712,6 +712,7 @@ export const frFR: LocalizationResource = {
cancelButton: undefined,
formButtonPrimary__add: undefined,
formButtonPrimary__pay: undefined,
+ payWithTestCardButton: undefined,
removeResource: {
messageLine1: undefined,
messageLine2: undefined,
diff --git a/packages/localizations/src/he-IL.ts b/packages/localizations/src/he-IL.ts
index 10c6f3d5c4b..b56a874e944 100644
--- a/packages/localizations/src/he-IL.ts
+++ b/packages/localizations/src/he-IL.ts
@@ -697,6 +697,7 @@ export const heIL: LocalizationResource = {
cancelButton: undefined,
formButtonPrimary__add: undefined,
formButtonPrimary__pay: undefined,
+ payWithTestCardButton: undefined,
removeResource: {
messageLine1: undefined,
messageLine2: undefined,
diff --git a/packages/localizations/src/hr-HR.ts b/packages/localizations/src/hr-HR.ts
index 7937b3dd386..faf4043e4ed 100644
--- a/packages/localizations/src/hr-HR.ts
+++ b/packages/localizations/src/hr-HR.ts
@@ -712,6 +712,7 @@ export const hrHR: LocalizationResource = {
cancelButton: undefined,
formButtonPrimary__add: undefined,
formButtonPrimary__pay: undefined,
+ payWithTestCardButton: undefined,
removeResource: {
messageLine1: undefined,
messageLine2: undefined,
diff --git a/packages/localizations/src/hu-HU.ts b/packages/localizations/src/hu-HU.ts
index c08c099d5c5..9153ff534d2 100644
--- a/packages/localizations/src/hu-HU.ts
+++ b/packages/localizations/src/hu-HU.ts
@@ -708,6 +708,7 @@ export const huHU: LocalizationResource = {
cancelButton: undefined,
formButtonPrimary__add: undefined,
formButtonPrimary__pay: undefined,
+ payWithTestCardButton: undefined,
removeResource: {
messageLine1: undefined,
messageLine2: undefined,
diff --git a/packages/localizations/src/id-ID.ts b/packages/localizations/src/id-ID.ts
index 51ffda3a147..aca03becdec 100644
--- a/packages/localizations/src/id-ID.ts
+++ b/packages/localizations/src/id-ID.ts
@@ -716,6 +716,7 @@ export const idID: LocalizationResource = {
cancelButton: undefined,
formButtonPrimary__add: undefined,
formButtonPrimary__pay: undefined,
+ payWithTestCardButton: undefined,
removeResource: {
messageLine1: undefined,
messageLine2: undefined,
diff --git a/packages/localizations/src/is-IS.ts b/packages/localizations/src/is-IS.ts
index c5edb52724e..247350cf99d 100644
--- a/packages/localizations/src/is-IS.ts
+++ b/packages/localizations/src/is-IS.ts
@@ -710,6 +710,7 @@ export const isIS: LocalizationResource = {
cancelButton: undefined,
formButtonPrimary__add: undefined,
formButtonPrimary__pay: undefined,
+ payWithTestCardButton: undefined,
removeResource: {
messageLine1: undefined,
messageLine2: undefined,
diff --git a/packages/localizations/src/it-IT.ts b/packages/localizations/src/it-IT.ts
index 7439d9bdaeb..5d720f34455 100644
--- a/packages/localizations/src/it-IT.ts
+++ b/packages/localizations/src/it-IT.ts
@@ -707,6 +707,7 @@ export const itIT: LocalizationResource = {
cancelButton: undefined,
formButtonPrimary__add: undefined,
formButtonPrimary__pay: undefined,
+ payWithTestCardButton: undefined,
removeResource: {
messageLine1: undefined,
messageLine2: undefined,
diff --git a/packages/localizations/src/ja-JP.ts b/packages/localizations/src/ja-JP.ts
index 01733fdd8a8..76022a854f4 100644
--- a/packages/localizations/src/ja-JP.ts
+++ b/packages/localizations/src/ja-JP.ts
@@ -706,6 +706,7 @@ export const jaJP: LocalizationResource = {
cancelButton: undefined,
formButtonPrimary__add: undefined,
formButtonPrimary__pay: undefined,
+ payWithTestCardButton: undefined,
removeResource: {
messageLine1: undefined,
messageLine2: undefined,
diff --git a/packages/localizations/src/ko-KR.ts b/packages/localizations/src/ko-KR.ts
index 5075e212836..40f8a361758 100644
--- a/packages/localizations/src/ko-KR.ts
+++ b/packages/localizations/src/ko-KR.ts
@@ -700,6 +700,7 @@ export const koKR: LocalizationResource = {
cancelButton: undefined,
formButtonPrimary__add: undefined,
formButtonPrimary__pay: undefined,
+ payWithTestCardButton: undefined,
removeResource: {
messageLine1: undefined,
messageLine2: undefined,
diff --git a/packages/localizations/src/mn-MN.ts b/packages/localizations/src/mn-MN.ts
index e30b386c81f..1bf0ff8c512 100644
--- a/packages/localizations/src/mn-MN.ts
+++ b/packages/localizations/src/mn-MN.ts
@@ -707,6 +707,7 @@ export const mnMN: LocalizationResource = {
cancelButton: undefined,
formButtonPrimary__add: undefined,
formButtonPrimary__pay: undefined,
+ payWithTestCardButton: undefined,
removeResource: {
messageLine1: undefined,
messageLine2: undefined,
diff --git a/packages/localizations/src/nb-NO.ts b/packages/localizations/src/nb-NO.ts
index f057068260e..ffeffad5358 100644
--- a/packages/localizations/src/nb-NO.ts
+++ b/packages/localizations/src/nb-NO.ts
@@ -706,6 +706,7 @@ export const nbNO: LocalizationResource = {
cancelButton: undefined,
formButtonPrimary__add: undefined,
formButtonPrimary__pay: undefined,
+ payWithTestCardButton: undefined,
removeResource: {
messageLine1: undefined,
messageLine2: undefined,
diff --git a/packages/localizations/src/nl-BE.ts b/packages/localizations/src/nl-BE.ts
index f41d30c7d49..3b9c980103b 100644
--- a/packages/localizations/src/nl-BE.ts
+++ b/packages/localizations/src/nl-BE.ts
@@ -705,6 +705,7 @@ export const nlBE: LocalizationResource = {
cancelButton: undefined,
formButtonPrimary__add: undefined,
formButtonPrimary__pay: undefined,
+ payWithTestCardButton: undefined,
removeResource: {
messageLine1: undefined,
messageLine2: undefined,
diff --git a/packages/localizations/src/nl-NL.ts b/packages/localizations/src/nl-NL.ts
index 224cf47f11c..95414fdb253 100644
--- a/packages/localizations/src/nl-NL.ts
+++ b/packages/localizations/src/nl-NL.ts
@@ -705,6 +705,7 @@ export const nlNL: LocalizationResource = {
cancelButton: undefined,
formButtonPrimary__add: undefined,
formButtonPrimary__pay: undefined,
+ payWithTestCardButton: undefined,
removeResource: {
messageLine1: undefined,
messageLine2: undefined,
diff --git a/packages/localizations/src/pl-PL.ts b/packages/localizations/src/pl-PL.ts
index 28d8007992a..3648616a768 100644
--- a/packages/localizations/src/pl-PL.ts
+++ b/packages/localizations/src/pl-PL.ts
@@ -715,6 +715,7 @@ export const plPL: LocalizationResource = {
cancelButton: undefined,
formButtonPrimary__add: undefined,
formButtonPrimary__pay: undefined,
+ payWithTestCardButton: undefined,
removeResource: {
messageLine1: undefined,
messageLine2: undefined,
diff --git a/packages/localizations/src/pt-BR.ts b/packages/localizations/src/pt-BR.ts
index 9bcd9bcf6b4..a50736b07a5 100644
--- a/packages/localizations/src/pt-BR.ts
+++ b/packages/localizations/src/pt-BR.ts
@@ -711,6 +711,7 @@ export const ptBR: LocalizationResource = {
cancelButton: undefined,
formButtonPrimary__add: undefined,
formButtonPrimary__pay: undefined,
+ payWithTestCardButton: undefined,
removeResource: {
messageLine1: undefined,
messageLine2: undefined,
diff --git a/packages/localizations/src/pt-PT.ts b/packages/localizations/src/pt-PT.ts
index 3f22af16403..76078f76782 100644
--- a/packages/localizations/src/pt-PT.ts
+++ b/packages/localizations/src/pt-PT.ts
@@ -705,6 +705,7 @@ export const ptPT: LocalizationResource = {
cancelButton: undefined,
formButtonPrimary__add: undefined,
formButtonPrimary__pay: undefined,
+ payWithTestCardButton: undefined,
removeResource: {
messageLine1: undefined,
messageLine2: undefined,
diff --git a/packages/localizations/src/ro-RO.ts b/packages/localizations/src/ro-RO.ts
index c1d51b7a3f0..62747cb3575 100644
--- a/packages/localizations/src/ro-RO.ts
+++ b/packages/localizations/src/ro-RO.ts
@@ -710,6 +710,7 @@ export const roRO: LocalizationResource = {
cancelButton: undefined,
formButtonPrimary__add: undefined,
formButtonPrimary__pay: undefined,
+ payWithTestCardButton: undefined,
removeResource: {
messageLine1: undefined,
messageLine2: undefined,
diff --git a/packages/localizations/src/ru-RU.ts b/packages/localizations/src/ru-RU.ts
index b7304a2073b..82f1004a651 100644
--- a/packages/localizations/src/ru-RU.ts
+++ b/packages/localizations/src/ru-RU.ts
@@ -720,6 +720,7 @@ export const ruRU: LocalizationResource = {
cancelButton: undefined,
formButtonPrimary__add: undefined,
formButtonPrimary__pay: undefined,
+ payWithTestCardButton: undefined,
removeResource: {
messageLine1: undefined,
messageLine2: undefined,
diff --git a/packages/localizations/src/sk-SK.ts b/packages/localizations/src/sk-SK.ts
index 4ef74d74654..1689168523a 100644
--- a/packages/localizations/src/sk-SK.ts
+++ b/packages/localizations/src/sk-SK.ts
@@ -703,6 +703,7 @@ export const skSK: LocalizationResource = {
cancelButton: undefined,
formButtonPrimary__add: undefined,
formButtonPrimary__pay: undefined,
+ payWithTestCardButton: undefined,
removeResource: {
messageLine1: undefined,
messageLine2: undefined,
diff --git a/packages/localizations/src/sr-RS.ts b/packages/localizations/src/sr-RS.ts
index 7b3477475a4..55fc3cbdfe1 100644
--- a/packages/localizations/src/sr-RS.ts
+++ b/packages/localizations/src/sr-RS.ts
@@ -706,6 +706,7 @@ export const srRS: LocalizationResource = {
cancelButton: undefined,
formButtonPrimary__add: undefined,
formButtonPrimary__pay: undefined,
+ payWithTestCardButton: undefined,
removeResource: {
messageLine1: undefined,
messageLine2: undefined,
diff --git a/packages/localizations/src/sv-SE.ts b/packages/localizations/src/sv-SE.ts
index 835f80318a7..412411bb0a4 100644
--- a/packages/localizations/src/sv-SE.ts
+++ b/packages/localizations/src/sv-SE.ts
@@ -709,6 +709,7 @@ export const svSE: LocalizationResource = {
cancelButton: undefined,
formButtonPrimary__add: undefined,
formButtonPrimary__pay: undefined,
+ payWithTestCardButton: undefined,
removeResource: {
messageLine1: undefined,
messageLine2: undefined,
diff --git a/packages/localizations/src/th-TH.ts b/packages/localizations/src/th-TH.ts
index 45c9e9d787b..685c5156464 100644
--- a/packages/localizations/src/th-TH.ts
+++ b/packages/localizations/src/th-TH.ts
@@ -705,6 +705,7 @@ export const thTH: LocalizationResource = {
cancelButton: undefined,
formButtonPrimary__add: undefined,
formButtonPrimary__pay: undefined,
+ payWithTestCardButton: undefined,
removeResource: {
messageLine1: undefined,
messageLine2: undefined,
diff --git a/packages/localizations/src/tr-TR.ts b/packages/localizations/src/tr-TR.ts
index af8d7df64a2..c213f86b231 100644
--- a/packages/localizations/src/tr-TR.ts
+++ b/packages/localizations/src/tr-TR.ts
@@ -709,6 +709,7 @@ export const trTR: LocalizationResource = {
cancelButton: undefined,
formButtonPrimary__add: undefined,
formButtonPrimary__pay: undefined,
+ payWithTestCardButton: undefined,
removeResource: {
messageLine1: undefined,
messageLine2: undefined,
diff --git a/packages/localizations/src/uk-UA.ts b/packages/localizations/src/uk-UA.ts
index 1006dd5f19c..be93ec563e1 100644
--- a/packages/localizations/src/uk-UA.ts
+++ b/packages/localizations/src/uk-UA.ts
@@ -703,6 +703,7 @@ export const ukUA: LocalizationResource = {
cancelButton: undefined,
formButtonPrimary__add: undefined,
formButtonPrimary__pay: undefined,
+ payWithTestCardButton: undefined,
removeResource: {
messageLine1: undefined,
messageLine2: undefined,
diff --git a/packages/localizations/src/vi-VN.ts b/packages/localizations/src/vi-VN.ts
index 0df9208a15d..3563feca430 100644
--- a/packages/localizations/src/vi-VN.ts
+++ b/packages/localizations/src/vi-VN.ts
@@ -704,6 +704,7 @@ export const viVN: LocalizationResource = {
cancelButton: undefined,
formButtonPrimary__add: undefined,
formButtonPrimary__pay: undefined,
+ payWithTestCardButton: undefined,
removeResource: {
messageLine1: undefined,
messageLine2: undefined,
diff --git a/packages/localizations/src/zh-CN.ts b/packages/localizations/src/zh-CN.ts
index 33f338d7eb1..01ef5ad5491 100644
--- a/packages/localizations/src/zh-CN.ts
+++ b/packages/localizations/src/zh-CN.ts
@@ -691,6 +691,7 @@ export const zhCN: LocalizationResource = {
cancelButton: undefined,
formButtonPrimary__add: undefined,
formButtonPrimary__pay: undefined,
+ payWithTestCardButton: undefined,
removeResource: {
messageLine1: undefined,
messageLine2: undefined,
diff --git a/packages/localizations/src/zh-TW.ts b/packages/localizations/src/zh-TW.ts
index bd126362cd1..eac36739209 100644
--- a/packages/localizations/src/zh-TW.ts
+++ b/packages/localizations/src/zh-TW.ts
@@ -692,6 +692,7 @@ export const zhTW: LocalizationResource = {
cancelButton: undefined,
formButtonPrimary__add: undefined,
formButtonPrimary__pay: undefined,
+ payWithTestCardButton: undefined,
removeResource: {
messageLine1: undefined,
messageLine2: undefined,
diff --git a/packages/testing/src/playwright/unstable/page-objects/checkout.ts b/packages/testing/src/playwright/unstable/page-objects/checkout.ts
index 5762b2f53d4..6cb3dc1c074 100644
--- a/packages/testing/src/playwright/unstable/page-objects/checkout.ts
+++ b/packages/testing/src/playwright/unstable/page-objects/checkout.ts
@@ -26,7 +26,10 @@ export const createCheckoutPageObject = (testArgs: { page: EnhancedPage }) => {
await frame.getByLabel('ZIP code').fill(card.zip);
},
clickPayOrSubscribe: async () => {
- await page.getByRole('button', { name: /subscribe|pay\s/i }).click();
+ await page
+ .locator('.cl-checkout-root')
+ .getByRole('button', { name: /subscribe|pay\s\$/i })
+ .click();
},
clickAddPaymentMethod: async () => {
await page.getByRole('radio', { name: 'Add payment method' }).click();
diff --git a/packages/types/src/commerce.ts b/packages/types/src/commerce.ts
index f23c3d9417b..4586b9b75c0 100644
--- a/packages/types/src/commerce.ts
+++ b/packages/types/src/commerce.ts
@@ -169,6 +169,10 @@ export type __experimental_ConfirmCheckoutParams = WithOptionalOrgType<
paymentToken?: string;
gateway?: __experimental_PaymentGateway;
}
+ | {
+ gateway?: __experimental_PaymentGateway;
+ useTestCard?: boolean;
+ }
>;
export interface __experimental_CommerceCheckoutResource extends ClerkResource {
id: string;
diff --git a/packages/types/src/localization.ts b/packages/types/src/localization.ts
index 6ba35dd1b53..b398e7c30cd 100644
--- a/packages/types/src/localization.ts
+++ b/packages/types/src/localization.ts
@@ -707,6 +707,7 @@ type _LocalizationResource = {
messageLine2: LocalizationValue;
successMessage: LocalizationValue;
};
+ payWithTestCardButton: LocalizationValue;
};
subscriptionsSection: {
actionLabel__default: LocalizationValue;