#arrayappy
1 messages ยท Page 1 of 1 (latest)
๐ happy to help
{
mode: "subscription",
payment_intent_data: {
metadata: {
sessionId,
},
},
}
It has some other info also in the object, I'm just providing only required
as the error stated you can not pass payment_intent_data in subscription mode
you can use https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-subscription_data-metadata
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Then how do attach sesssionId, so that I can see the sessionId in payments page metadata (not subscriptions page)
you can copy the value on checkout.session.complete
from the subscription object to the latest_invoice.payment_intent
on the subscription
metadata: {
sessionDocId,
payment_intent_data: {
metadata: {
businessId,
},
},
},
},```
I'm getting > StripeInvalidRequestError: Invalid value type: {:metadata=>{:businessId=>"zsjFoCrR5bB8Ylw1wAkG"}} must be a string
How ??
the metadata in subscription_data should be (key, value) pairs it can't hold objects
so you can't nest paymetn_intent_data.metadata under metadata
you just need to add both sessionDocId and businessId at the same level
and when you listen to the checkout.session.complete event in your webhook endpoint you retrieve the subscription and you update the latest_invoice.payment_intent's metadata with the values from the subscription.metadata
Okk
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.