Reputation: 421
I successfully created payment intents from a customer's card paying to a Standard Connected account using destination charge. In that payment intent created, I am specifying a description:
const paymentIntent = await stripe.paymentIntents.create({
amount: calculate_payment_amount(duration_minutes),
customer: "somet id",
currency: "usd",
description: `chat duration: 100`,
payment_method: paymentMethods.data[0].id,
payment_method_types: ['card'],
off_session: true,
confirm: true,
application_fee_amount: calculate_fee_amount(duration_minutes),
transfer_data: {
destination: "standard connected account ID",
},
metadata: {
metadata: "something
},
});
This payment displays the description if I view it from my platform's dashboard.
But if the standard connected account were to view this payment, the user won't be able to see the description (the same payment viewed from the standard account):
Is it possible to pass or propagate the same description of the payment intent to the same payment of the standard connected account?
Upvotes: 3
Views: 1156
Reputation: 3240
Unfortunately, it doesn't look like it's currently possible to propagate the PaymentIntent description when creating destination charges. You would need to manually update the payment on the connected account with the description:
To do so, first, create the payment intent like you are doing now, except save the description as a standalone variable:
const paymentDescription = `chat duration: 100`;
const connectedAccountId = "acct_xyz";
const paymentIntent = await stripe.paymentIntents.create({
amount: calculate_payment_amount(duration_minutes),
customer: "somet id",
currency: "usd",
description: paymentDescription,
payment_method: paymentMethods.data[0].id,
payment_method_types: ['card'],
off_session: true,
confirm: true,
application_fee_amount: calculate_fee_amount(duration_minutes),
transfer_data: {
destination: connectedAccountId,
},
metadata: {
metadata: "something
},
});
Then, after the payment is confirmed, get the payment resulting from the transfer to the connected account:
const transfers = await stripe.transfers.list({
destination: connectedAccountId,
transfer_group: paymentIntent.transfer_group,
});
const paymentId = transfers.data[0].destination_payment;
The key above is that when you do a destination charge, Stripe will create a transfer and a payment (in the form of a Charge) to the connected account in the background. Here we're getting the transfer associated with the payment intent, and from that getting the associated payment. This is the py_xyz
ID that you see when viewing the payment in the connected account's dashboard.
Then, update the payment to include the description:
const updatedPayment = await stripe.charges.update(
paymentId,
{
description: paymentDescription,
},
{
stripeAccount: connectedAccountId,
}
);
At that point the description will show in the standard account's payment view:
Upvotes: 4