Skip to content
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

Fix Payment Request Button element creation types #4

Merged
merged 2 commits into from
Feb 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions tests/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,13 @@ const paymentRequestButtonElement = elements.create('paymentRequestButton', {
theme: 'light',
},
},
paymentRequest: stripe.paymentRequest({
country: 'US',
currency: 'usd',
total: {label: 'Demo total', amount: 1000},
requestPayerName: true,
requestPayerEmail: true,
}),
});

const retrievedPaymentRequestButtonElement: StripePaymentRequestButtonElement | null = elements.getElement(
Expand Down
4 changes: 3 additions & 1 deletion types/stripe-js/elements.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,12 @@ declare module '@stripe/stripe-js' {

/**
* Creates a `PaymentRequestButtonElement`.
*
* @docs https://stripe.com/docs/stripe-js/elements/payment-request-button
*/
create(
elementType: 'paymentRequestButton',
options?: StripePaymentRequestButtonElementOptions
options: StripePaymentRequestButtonElementOptions
): StripePaymentRequestButtonElement;

/**
Expand Down
5 changes: 5 additions & 0 deletions types/stripe-js/elements/payment-request-button.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@ declare module '@stripe/stripe-js' {
height?: number;
};
};

/**
* A `PaymentRequest` object used to configure the element.
*/
paymentRequest: PaymentRequest;
}

interface StripePaymentRequestButtonElementClickEvent {
Expand Down