#gabriel-sieben_unexpected
1 messages ยท Page 1 of 1 (latest)
๐ Welcome to your new thread!
โฒ๏ธ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
๐ This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1233433366641119402
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
Hi ๐ that's expected with Destination Charges as far as I'm aware. The Payment Intent created by the Checkout Session is created on your Platform account. Then a Transfer is created to move the funds to the Connected Account, which results in a Charge/Payment being created on the Connected Account.
It's that object's description that needs to be updated. Do you have an example from your testing that I could take a closer look at to make sure that's the case here?
Hm, seeing a null description in your dashboard sounds unexpected.
Hello,
I create the payment with the PHP SDK as follows:
$session = $stripe->checkout->sessions->create([
'line_items' => [
[
'price_data' => [
'currency' => 'usd',
'product_data' => [
'name' => 'Payment to ' . $instructor->name . ' for services in ' . $course->name,
],
'unit_amount' => $amount,
],
'quantity' => 1,
],
],
'customer' => $customer,
'payment_intent_data' => [
'application_fee_amount' => (int) ($amount * 0.05),
'description' => 'TEST',
'transfer_data' => ['destination' => $instructor->live_stripe_connect_id],
],
'billing_address_collection' => 'required',
'phone_number_collection' => [
'enabled' => true,
],
'consent_collection' => [
'terms_of_service' => 'required',
],
'metadata' => [
// ...
],
'currency' => 'usd',
'mode' => 'payment',
'success_url' => URL::previous(),
'cancel_url' => URL::previous(),
]);
return redirect($session->url);
Running this exact code through, the docs would suggest that the description would be TEST. However, when running this exact code (I changed it to "TEST" to show there is no logic error):
The description has been autofilled. And in the backend:
Nope, TEST should not carry through to the Express Dashboard. It should show on your Platform's Stripe dashboard.
But it does not:
Can you share an ID of an object so I can take a closer look at things? A Payment Intent or a Checkout Session?
This one I just did 4 minutes ago: py_1P9qQFQwVLezurzi72AAa9lp
I also just now created a session with the parameters above at: cs_test_a1HQvkkcY1p6qXzYdmgZuE0vdkiLGPR4DKn0V5yMaZ3qCKeBm0AnHJzU2h
I checked the Payment Intent from your Platform account that created this Payment(Charge) object. That Payment Intent does have it's description set to TEST as expected.
Are you looking at a different Payment Intent in your screenshot (it's too cropped for me to tell)?
I also confirmed the Payment(Charge) you referenced, py_1P9qQFQwVLezurzi72AAa9lp, does not have a description set currently. If you update the description on that Charge object, does it reflect in the Express Dashboard as you're expecting?
https://docs.stripe.com/api/charges/update#update_charge-description
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
I've got my logging tools open, so if you're OK with it, can I do this:
- Create a session, give you the ID, let you verify it's good with the description as
TEST - Process the session, hand you payment ID, let you verify the state after checkout
Sure, but I expect it'll show the same behavior I've already described.
I've created my session with cs_test_a1hwAVrUdP91rbfhpPF4GAp0aWQAxqT1rYWpnGkAvx6TbQOvdfrPpg55rT
The description should be active
Nope, you set it to TEST
Right, I mean that the description is there
When I created the session
Sorry about my use of "active," I meant present, set
Correct. So when the session is completed that description will be put on the Payment Intent that is created for your Platform Account. It will not be carried through to the Payment created by the resulting Transfer to the Connected Account.
So you're saying that it's normal, now that I've completed the checkout process, and received a payment ID of py_1P9qeyQwVLezurziN7MxQQfV, that the payment would have no description?
That's correct
The Payment Intent on your Platform account did have it's description set:
pi_3P9qexJOu1Ec6Sfm2xa5xl9n
The Payment(Charge) created by the Transfer made to the Connected Account doesn't get that same description set. You will need to add logic to update the description for that object:
py_1P9qeyQwVLezurziN7MxQQfV
Okay, no wonder I was getting confused... is there a way to name the Payment(Charge) at the time of setting up the Checkout, or does it need to be a post-Checkout edit?
Totally fair, it is a bit confusing ๐ I'll be filing some feedback to see if we can make this easier in the future.
Right now that has to be done as a follow-up action. It's currently not possible to pass a description that will be set on the object created on the Connected Account.
I'll be filing some feedback to see if we can make this easier in the future.
Great. At a minimum though, maybe the docs could have a mention; though maybe I'm the first person to be confused.
Right now that has to be done as a follow-up action. It's currently not possible to pass a description that will be set on the object created on the Connected Account.
Cool. I'd assume I can look up the py_ from the webhook response...
Actually that's my next question. Where can I find the py_?
I don't see it in the data returned when querying the pi_ number, which is available from the session ID
I would suggest trying to listen for transfer.created Events on your Platform account. The Transfer object should reference both the destination_payment and the source_transaction within it that you can then use to pull/copy the description.
Okay. I can do that. However, if I wanted to look it up at an arbitrary time (which should be rare, I'm just thinking like if our endpoint went down or something along those lines, and we needed to find previous transactions), where would that be?
Right now I would capture the session_id post checkout and store it in my app. Is it possible to chain retrieved IDs together to get there (like, find the payment intent, find the py_, etc...) or is that not an option?
Yup. The Checkout Session contains the ID of the Payment Intent. The Payment Intent should have a transfer_group field that we automatically populate, which can be used to list related Transfers:
https://docs.stripe.com/api/transfers/list#list_transfers-transfer_group
Once you find the Transfer you check it's destination_payment to finish making the association. If you think you'll need to look up that association more than once, you can add logic to store a related ID in metadata on an object after doing the lookup the first time.
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Okay, so I think I've got the flow:
Session retrieved by session_id has a payment_intent ID on it;
The PaymentIntent retrieved by that ID has a transfer_group,
Which can be retrieved by listing all Transfer objects which have the same transfer_group,
And each one of them has a destination_payment ID which starts with py_,
Which is the actual payment which we can set a description on to adjust what it says in the dashboard
Got it. I think what I have what I need now. My only suggestion then for feedback: It would be much easier if we could set a description when just setting up the Checkout Session. ๐
(And the docs need to clarify that payment_intent_setup.description does not adjust the py_ description, but the pi_ description, leading to the illusion nothing happened which confused me.)
The goal ultimately is to just change the description in the Stripe Express dashboard, for each payment, to have more context than "Payment by Homeschool Connections" (our business name)
Which would be super elegant if that could be set up when creating the Checkout session, but, oh well, future improvement maybe
Thank you!