I am doing a simple task. Code is already working. Following are the steps:
using this post: https://stripe.com/docs/checkout/integration-builder
purchasing ticket from UI
creating checkout session in the backend and passing requried data. These all is working fine.
const session = await this._stripe.checkout.sessions.create({
payment_method_types: ['card'],
customer_email: email,
line_items: [
{
price_data: {
currency: ###,
unit_amount_decimal: ###,
product_data: {
name: ###,
description: ###
}
},
quantity: 1
}
],
payment_intent_data: {
on_behalf_of: ###,
transfer_data: {
destination: ###,
amount: ###
},
metadata,
statement_descriptor: ###
},
mode: 'payment',
success_url: successUrl,
cancel_url: cancelUrl
});
code is working fine and I am able to get the payment done and it is reflected into my main account with metadata and other fields.
Issue: I want the same metadata into my connected account where I am transferring money so that we can share the same metadata. There is a metadata section into payment inside the connected/destination account. That's where I want to add those details. Is there anything else I need to update like charge or transfer or anything? I tried updating transfer but none of them reflected metadata into the destination account.
Where should I add what params to get metadata into my connected account? Any help will be great. Thanks
When funds are transferred from your platform account to a connected account two objects are created to represent the transfer:
tr_) that exists on your platform accountpy_) that exists on the connected accountIn the Stripe API Payment objects are a type of Charge, so you can use the Charges API to add metadata to the Payment object.
Note: Payment objects exist on connected accounts, not on your platform account, so you need to make an API call on behalf of the connected account to access/modify Payment objects.
You can get the Payment object's ID by looking at the destination_payment property on the Transfer.