Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
5.0k views
in Technique[技术] by (71.8m points)

payment processing - Stripe API: How do you find the exchange rate and amount in foreign currency of a cross border transfer to a Connect Account?

I'm using Stripe to process payments. I have a platform where international Connect accounts can sell items to others through my platform.

My platform is USD. In this specific example, the Connect account is in CAD (Canada Dollar). When someone purchases an item from this CAD Connect Account, Stripe puts the money in my platform account, leaves my app fee there, and then moves the correct amount into the CAD Connect account. It converts this amount to CAD. In the stripe GUI I can find the exchange rate and amount transferred in CAD, as circled in the screenshot below. But I can't find these attributes in the API.

enter image description here

The only object I've seen with an exchange_rate attribute is the balance transaction. However, when I get the balance transaction for the transaction in the screenshot, I get this response object:

Request: https://api.stripe.com/v1/balance_transactions/txn_1IBNiNLLBOhef2QNqIeaNg9o

Response:

{ 
"id": "txn_1IBNiNLLBOhef2QNqIeaNg9o", 
"object": "balance_transaction", 
"amount": -7777, 
"available_on": 1611619200, 
"created": 1611076199, 
"currency": "usd", 
"description": null, 
"exchange_rate": null, 
"fee": 0, 
"fee_details": [], 
"net": -7777, 
"reporting_category": "transfer", 
"source": "tr_1IBNiNLLBOhef2QNcNqv3IlS", 
"status": "pending", 
"type": "transfer" }

The problem here is that the balance transaction object above only shows this transaction in USD: $77.77 USD came out of my platform account.

But it doesn't show the conversion rate or the amount in CAD. When this $77.00 went into the CAD Connect account, as we can see in the GUI screenshot, that $77.77 was converted to $98.02 CAD and the exchange rate was 1.26039 (USD->CAD).

How can I find this CAD amount and exchange rate through the API?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

The Transfer made to the connected account in this screenshot is in USD. The conversion happens after the Transfer itself. The funds are sent in USD and then in the connected account they get converted to that account's default Currency.

You want to look at the Transfer's destination_payment property which has the py_123 id for the Charge on the connected account. That Charge has a BalanceTransaction object (similar to the Transfer one you shared). That BalanceTransaction would reflect the conversion from USD to CAD and surface the exchange rate used in the exchange_rate property in that case.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...