#directmarketplace
1 messages · Page 1 of 1 (latest)
we also pass an membership id
how do you do that exactly, via which API parameter?
I'd also recommend reading https://dev.to/stripe/purchase-fulfilment-with-checkout-or-wait-what-was-i-paid-for-335d , since it's a bit complex to get details of what was paid for(you need to make an extra API call to retrieve the line items).
const session = await stripe.checkout.sessions.create({
line_items: [{
price: PRICE_ID,
quantity: 1,
}],
payment_intent_data: {
application_fee_amount: 123,
},
mode: 'payment',
success_url: 'http://domain.com?session_id={CHECKOUT_SESSION_ID}&client_reference_id=' + MEMBER_ID
}, {
stripeAccount: CONNECTED_ACCOUNT_ID,
});
Finding the perfect website domain is as easy as 1-2-3. Buy a domain name, build and host a website, and enjoy our professional online marketing tools.
well then the member ID is only available to your web server by reading the URL parameters when the customer is redirected to that page after paying in Checkout
maybe you should put the ID in metadata for the CheckoutSession instead so you can access it from backend code accessing the object or events later?
sounds good i can put product darta there as well
How to add meta data tomy above code thanks
metadata:{member_id:"1234567"},
what is i have multiple ky value pairs do i do metadata: [{member_id:"1234567"},{member_name:"john"}] or some other format thanks
I suggest just trying it
it's metadata:{foo:"bar", other:"baz", test:"string"} anyway, just an object
testing
const session = await stripe.checkout.sessions.create({
line_items: [{
price: PRICE_ID,
quantity: 1,
}],
metadata: [{
membershipid: MEMBER_ID,
price: PRICE_ID,
}],
payment_intent_data: {
application_fee_amount: 123,
},
mode: 'payment',
success_url: 'http://www.ipass.tv?session_id={CHECKOUT_SESSION_ID}&client_reference_id=' + MEMBER_ID
}, {
stripeAccount: CONNECTED_ACCOUNT_ID,
});
did not work
Where should I put the metadata thanks
it's not an array
Using it here creates a n error saying the checkout can't be found
I never said it was an array, it's an object
whoops!
await stripe.checkout.sessions.create({
line_items: [{
price: PRICE_ID,
quantity: 1,
}],
metadata: {
membershipid: MEMBER_ID,
price: PRICE_ID,
},,,,
}, {
stripeAccount: CONNECTED_ACCOUNT_ID,
});
Perfect. Thanks for the help