#aruljothi-apply-pay-sub
1 messages · Page 1 of 1 (latest)
i need to create subscription for apple pay
i already spoke with support team 2 days before
they asked to attach payment method to the customer and create subscription
paymentRequest.on('paymentmethod', function(event) {
// event.paymentmethod is available
});
attach it to the customer: https://stripe.com/docs/api/payment_methods/attach
After that, i create a subscription for that customer: https://stripe.com/docs/api/subscriptions/create, and to used that payment method i just attached and passed default_payment_method parameter https://stripe.com/docs/api/subscriptions/create#create_subscription-default_payment_method
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
alright, are you facing an issue?
yes
one moment i will give issue
invalid_request_error
This PaymentMethod was previously used without being attached to a Customer or was detached from a Customer, and may not be used again.
this error fro subscrption creation
if you don't attach the payment method to a customer, or if the payment method was detached, the payment method cannot be used again (i.e. it is single use only)
looks like what happened is that you created a PaymentIntent, collected the card details and confirmed the payment via stripe.js (Elements)
what you need to do to automatically attach the card to the customer, is to either include setup_future_usage=off_session [0] on the PaymentIntent or in stripe.confirmCardPayment [1]
[0] https://stripe.com/docs/api/payment_intents/create#create_payment_intent-setup_future_usage
[1] https://stripe.com/docs/js/payment_intents/confirm_card_payment#stripe_confirm_card_payment-data-setup_future_usage