stripe/react-stripe-js

[BUG]: Element create "payment" does not have applePay object type

Closed this issue · 2 comments

What happened?

When I enter this code:

const paymentElement = elements.create('payment', {
applePay: {
recurringPaymentRequest: {
paymentDescription: 'My subscription',
managementURL: 'https://example.com/billing',
regularBilling: {
amount: 2500,
label: 'Monthly subscription fee',
recurringPaymentIntervalUnit: 'month',
recurringPaymentIntervalCount: 1,
},
},
},
});

This is the error I'm getting:
No overload matches this call.
The last overload gave the following error.
Argument of type '"payment"' is not assignable to parameter of type '"issuingCardCopyButton"'.ts(2769)
elements-group.d.ts(509, 3): The last overload is declared here.
⚠ Error (TS2769)  | 

No overload matches this call.

Environment

No response

Reproduction

No response

@imjimmyphan This looks like only a type error, not a runtime problem correct?
Your params appear to match the structure documented: https://stripe.com/docs/js/elements_object/create_payment_element#payment_element_create-options-applePay-recurringPaymentRequest

What version of @stripe/stripe-js are you currently using? Note that these types were recently added in v2.2.2: https://github.com/stripe/stripe-js/blob/v2.2.2/types/stripe-js/elements/apple-pay.d.ts

If you're not using at least that version (currently the latest version), then please upgrade and try again. If you're still having issues after that, please share a repro we can inspect.

stale commented

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.