Skip to content

Commit

Permalink
Add paymentMethodOptions type to the Elements group (#504)
Browse files Browse the repository at this point in the history
  • Loading branch information
jackieosborn-stripe authored Sep 22, 2023
1 parent 33ab60a commit fe064f3
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tests/types/src/valid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@ const options: StripeElementsOptions = {
captureMethod: 'automatic',
paymentMethodTypes: ['card'],
paymentMethodCreation: 'manual',
paymentMethodOptions: {
card: {require_cvc_recollection: true},
},
appearance: {
disableAnimations: false,
theme: 'night',
Expand Down Expand Up @@ -119,6 +122,9 @@ stripe.elements({
capture_method: 'automatic',
payment_method_types: ['card'],
payment_method_creation: 'manual',
payment_method_options: {
us_bank_account: {financial_connections: {permissions: ['payment_method']}},
},
});

const elementsClientSecret: StripeElements = stripe.elements({
Expand Down
26 changes: 26 additions & 0 deletions types/stripe-js/elements-group.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -617,6 +617,18 @@ export type StripeElementLocale =
| 'zh-HK'
| 'zh-TW';

type PaymentMethodOptions = {
card?: {require_cvc_recollection?: boolean};
us_bank_account?: {
financial_connections?: {
permissions?: Array<
'balances' | 'ownership' | 'payment_method' | 'transactions'
>;
};
verification_method?: 'automatic' | 'instant';
};
};

/**
* Options to create an `Elements` instance with.
*/
Expand Down Expand Up @@ -771,6 +783,20 @@ export interface StripeElementsOptionsMode extends BaseStripeElementsOptions {
*/
payment_method_creation?: 'manual';

/**
* Additional payment-method-specific options for configuring Payment Element behavior.
*
* @docs https://stripe.com/docs/js/elements_object/create_without_intent#stripe_elements_no_intent-options-paymentMethodOptions
*/
paymentMethodOptions?: PaymentMethodOptions;

/**
* Additional payment-method-specific options for configuring Payment Element behavior.
*
* @docs https://stripe.com/docs/js/elements_object/create_without_intent#stripe_elements_no_intent-options-paymentMethodOptions
*/
payment_method_options?: PaymentMethodOptions;

/**
* Either use mode or clientSecret when creating an Elements group
*/
Expand Down

0 comments on commit fe064f3

Please sign in to comment.