#directmarketplace

1 messages · Page 1 of 1 (latest)

livid valveBOT
alpine hedge
#

we also pass an membership id
how do you do that exactly, via which API parameter?

covert niche
#

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,
});

alpine hedge
#

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?

covert niche
#

sounds good i can put product darta there as well

covert niche
#

How to add meta data tomy above code thanks

alpine hedge
#

metadata:{member_id:"1234567"},

covert niche
#

what is i have multiple ky value pairs do i do metadata: [{member_id:"1234567"},{member_name:"john"}] or some other format thanks

alpine hedge
#

I suggest just trying it

#

it's metadata:{foo:"bar", other:"baz", test:"string"} anyway, just an object

covert niche
#

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

alpine hedge
#

it's not an array

covert niche
#

Using it here creates a n error saying the checkout can't be found

alpine hedge
#

I never said it was an array, it's an object

covert niche
#

whoops!

alpine hedge
#
await stripe.checkout.sessions.create({
  line_items: [{
    price: PRICE_ID,
    quantity: 1,
  }],
  metadata: {
    membershipid: MEMBER_ID,
    price: PRICE_ID,
  },,,,
}, {
  stripeAccount: CONNECTED_ACCOUNT_ID,
});
livid valveBOT
covert niche
#

Perfect. Thanks for the help