-
Notifications
You must be signed in to change notification settings - Fork 147
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add defaultValues
to StripePaymentElementOptions
interface
#332
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -266,6 +266,21 @@ const afterpayClearpayMessageElement = elements.create( | |
); | ||
|
||
const paymentElement: StripePaymentElement = elements.create('payment', { | ||
defaultValues: { | ||
billingDetails: { | ||
name: 'Jane Doe', | ||
email: 'jane.doe@example.com', | ||
phone: '8004444444', | ||
address: { | ||
line1: '354 Oyster Point Blvd', | ||
line2: '', | ||
city: 'South San Francisco', | ||
state: 'CA', | ||
country: 'US', | ||
postalCode: '94080' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And then same here :) |
||
} | ||
} | ||
}, | ||
fields: { | ||
billingDetails: { | ||
email: 'never', | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -110,6 +110,24 @@ export type StripePaymentElement = StripeElementBase & { | |
collapse(): StripePaymentElement; | ||
}; | ||
|
||
export interface DefaultValuesOption { | ||
billingDetails?: | ||
{ | ||
name?: string; | ||
email?: string; | ||
phone?: string; | ||
address?: | ||
{ | ||
country?: string; | ||
postalCode?: string; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @jackieosborn-stripe Thank you for the quick review and nice catch! And just to surface it, it seems inconsistent, for example with the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Updated it in 2ad16db. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for bringing it up - we're aware of the inconsistencies 🙂 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Awesome! Thank you! Looking forward to getting this released! 🎉 |
||
state?: string; | ||
city?: string; | ||
line1?: string; | ||
line2?: string; | ||
}; | ||
}; | ||
} | ||
|
||
export type FieldOption = 'auto' | 'never'; | ||
|
||
export interface FieldsOption { | ||
|
@@ -152,6 +170,11 @@ export interface WalletsOption { | |
} | ||
|
||
export interface StripePaymentElementOptions { | ||
/** | ||
* Provide initial customer information that will be displayed in the Payment Element. | ||
*/ | ||
defaultValues?: DefaultValuesOption; | ||
|
||
/** | ||
* Override the business name displayed in the Payment Element. | ||
* By default the PaymentElement will use your Stripe account or business name. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure how exhaustive I should be for the tests. Please let me know if anything can be added!