Reputation: 63
I am using stripe connect in "test mode" and i am trying to create a subscription: In the front end I create a token with the stripe card elements. I am then sending this token, and some other information to my server where i create a subscription object using this method:
subscription = stripe.Subscription.create(
customer=customer["id"],
items=[
{
"price": sprice,
},
],
expand=["latest_invoice.payment_intent"],
application_fee_percent = 5,
transfer_data={
"destination": "*******************",
},
)
I then retrieve the payment intent in the latest invoice and get the client secret:
client_secret = subscription["latest_invoice"]["payment_intent"].client_secret
I then send this client secret back to the front end where i confirm the card payment:
var stripe = Stripe('**********************', {
stripeAccount: "*****************"
});
stripe.confirmCardPayment(clientSecret, {
payment_method: {
card: {
token: token,
},
},
I always get the same error: no such payment intent. I would love a bit of help :) Thanks
Upvotes: 0
Views: 232
Reputation: 2163
Since you're creating a subscription using destination charges (without using the stripeAccount
header), you don't need to set the stripeAccount
header when you initialize Stripe client-side.
Your current code:
var stripe = Stripe('**********************', {
stripeAccount: "*****************"
});
should be changed to this:
var stripe = Stripe('pk_xxx');
Upvotes: 2