#arrayappy

1 messages ยท Page 1 of 1 (latest)

crystal socketBOT
magic creek
#

๐Ÿ‘‹ happy to help

winter aurora
#

{
mode: "subscription",
payment_intent_data: {
metadata: {
sessionId,
},
},
}

It has some other info also in the object, I'm just providing only required

magic creek
#

as the error stated you can not pass payment_intent_data in subscription mode

winter aurora
#

Then how do attach sesssionId, so that I can see the sessionId in payments page metadata (not subscriptions page)

magic creek
#

you can copy the value on checkout.session.complete

#

from the subscription object to the latest_invoice.payment_intent

#

on the subscription

winter aurora
#
            metadata: {
                sessionDocId,
                payment_intent_data: {
                    metadata: {
                        businessId,
                    },
                },
            },
        },```

I'm getting >  StripeInvalidRequestError: Invalid value type: {:metadata=>{:businessId=>"zsjFoCrR5bB8Ylw1wAkG"}} must be a string
winter aurora
magic creek
#

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

winter aurora
#

Okk

magic creek