#rdsdaw2022 - Application Fee Ids

1 messages ยท Page 1 of 1 (latest)

floral surge
#

Hi ๐Ÿ‘‹

onyx flint
#

Hello Snufkin

floral surge
onyx flint
#

I used direct charge instead of transfer. And I saw following in the API docs.
const refund = await stripe.refunds.create({
charge: '{CHARGE_ID}',
refund_application_fee: true,
}, {
stripeAccount: '{{CONNECTED_STRIPE_ACCOUNT_ID}}',

});

#

But I do not have Charge Id. I have payment_intent_id.

floral surge
#

That will work

#

You can also get the Charge ID from the Payment Intent

onyx flint
#

so I can put payment_intent_id in the Charge key?

floral surge
#

Gonna test that. Give me a sec

onyx flint
#

thank you

floral surge
#

Okay you will need to specify the Charge ID ch_XXXX

#

You can find this on the Payment Intent object in the charges:[] array

#

Sorry, charges.data: [] is the array.

onyx flint
#

yeah, that array does not have charge_id

floral surge
#

Can you share the PI ID?

onyx flint
#

"charges": {
"object": "list",
"data": [

],
"has_more": false,
"total_count": 0,
"url": "/v1/charges?payment_intent=pi_3KyzsLEna0Ypzfuf13YQh9gR"

}

#

there is the Payment Intent Id

floral surge
#

I'm not sure where you are grabbing that data from but the Payment Intent does have a charge in it

#

There is also a successful refund

onyx flint
#

I grabbed it from the response I got. There is successful refund, but the application_fee_amount of 20 cents is not deducted from the platform account

#

So I am looking how I can refund the application_fee_amount back to the connected account.

#

Also, where do you see Charge Id? I do not see even when I look at the Logs for that payment intent. All I see in the enpty data array inside it. What I had posted above.

floral surge
#

Yeah I'm looking in admin view. In some views we don't display all the data because it isn't relevant. I'm looking for where you can see the whole thing

onyx flint
#

I see ok. Is there any way I can get the Charge_id from payment_intent_id?

floral surge
#

Sure: ch_3KyzsLEna0Ypzfuf18DmpZP9

onyx flint
#

Even in this link, the response shown doe snot have charge_id in it.

floral surge
#

What do you mean "in this link"? This page is just trying to show you how you would use the API to retrieve a Payment Intent and an example of what one would look like

onyx flint
#

I meant that example response. On that example, I do not see Charge_Id

floral surge
#

It's not expected that there is always a charge. If the Payment Intent has not created a charge yet

#

Payment Intents can have 0, 1, or more charges associated with them

onyx flint
#

When the payment is successful, would not there be a Charge? The payment was successful for this payment intent.

floral surge
#

Nope then there is a charge, which I can see and you would if you retrieved the object from the API

onyx flint
#

ok. I will try to pull through the API then, perhaps the example response just shows the payment_intent before the status of succeeded.

floral surge
#

When you look at the Payment Intent in the Dashboard, what do you see in the Connections section?

#

Additionally, if you look in the Events and logs section, you should see the Charge in the event for the Payment Intent succeeding. You will need to expand the data view though

onyx flint
#

Where is the connections section? I just look at Logs after clicking the Developers Tab. On the Logs, I see the 200 OK for the confirm payment, but the response body I see does not have Charge_id

#

In fact it does not even have Charge section at all on the Response Body

floral surge
#

Look in the Payments tab of the Dashboard and find the payment

onyx flint
#

ok I see in there. thanks for pointing me to right place to see.

#

How does the application_fee_amount get refunded to connected account if it is partial refund?

#

that is why I wanted to use the application_fee id so that I could send the correct application_fee amount to be refunded.

floral surge
#

It's automatically proportional to the amount refunded/total amount

onyx flint
#

Will there not be rounding issues?

onyx flint
#

I get "message": "Received unknown parameter: id", when I try to retrieve payment_intent object using the id.

floral surge
#

The pattern for the URL is as follows: GET /v1/payment_intents/:id. where :id is the id you passed ( no "retrieve", no "?id=")

onyx flint
#

I see thanks