-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Forex #564
Forex #564
Conversation
This provides a better experience for customers who have accounts denominated | ||
in other currencies, and reduces chargeback rates for those customers as well. | ||
|
||
Scenario: Debit a card in ⬠|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
�
is either a new crypto currency or an encoding error...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dammit. Yeah, should be €. fixing...
Green! . ha! ... I guess this means we aren't actually validating the currency field server side. 😅 |
validate? fields? what? madness did you assert that the field comes back with the same currency that you set? |
@mjallday point taken. we don't test the invoicing stuff here at all, right? |
@steveklabnik @mjallday completely agree. Fees should in my opinion be a separate concern of the API. |
Reverted that commit. |
Bam. 157 currencies. |
There needs to be information on the response for the Debit that specifies by how much the escrow increased (in the escrow's or order escrow's currency). This is required for a marketplace to be able to audit the increase in their escrow balance. |
(above comment by @matin ) |
Would a currency pair quote solve that? e.g. EUR/USD=1 If there was a forex quote resource you could query that ahead of time to get the exchange rate, submit to with the transaction (before the quote expires) to guarantee the transaction gets that rate (omitting the quote would give you a rate of whatever is current), and then link to the quote on the transaction to provide the auditing you are asking for. |
@mjallday seeing what the converted number is and a convenient ratio on the debit's response is extremely useful. @steveklabnik and @matin are correct, they'd like to audit their escrow balance, but I personally think no customer will run analytics by querying all the debits from our API. I think they'll request for a bulk export and or a way to view their invoices in a deep dive to see what their starting balance at the start of the day and all the invoice events generated for that day of business. |
they do build state machines that listen to webhooks and do their own reconciliation from that. (based on personal experience in irc helping implement such) |
Let's get some customers to plz testify to this. I think they'd rather fetch a different resource (like invoices) 2 do their computations from that rather than querying all debits. That seems like a fools errand 2 me. |
TESTIFY BROTHER! CAN I GET AN AMEN? https://botbot.me/freenode/balanced/2014-03-24/?tz=America/Los_Angeles Read the conversation between jondkinney and myself. Invoices are hard to use for reconciliation. The issue that I've heard with using invoices is that they have to trust us to get the math correct. If they want to verify this themselves then they need to build a state machine and adjust the escrow as txns go through various states. This is digressing from the forex conversation, either way I believe we need to provide them with the exchange rate that the transaction was assigned. |
I'm going to have a discussion with Cath and Tim today about some of this, as well. |
Right, so there's two things here: first, that having the information also be in the debit rather than in an invoice would be useful, and that will probably be the same for forex. So the real question is naming, I guess. Sometimes, a debit goes to an order, and sometimes, it doesn't, so |
@steveklabnik can you explain what you mean by "the information"? I assume you're trying to figure out how best to return the amount (in the currency of the escrow). In the case where Balanced only supports a Order/escrow in USD, you can have the field be What's stopping you from using that field name to keep it simple for now? |
Yes, your assumption was correct. I guess I'm wary of creating yet another USD-specific name baked in. What happens when we have multiple currency escrows? |
We'll have learned a lot more than we know now about customer behavior and what people want. At which time, we can add a new revision and solve the problem based on everything that we've learned. If you do accept that |
@matin why not just return the currency back w/ every amount? |
Assume the marketplace escrow or order is denominated in USD. A debit should return something like: {
"amount": 10000,
"currency": "EUR",
"amount_in_order_currency": 13187,
"order_currency": "USD"
} There's two currencies: the currency of the buyer and the currency of the marketplace/order |
Seems good. |
@@ -27,7 +27,164 @@ | |||
"currency": { | |||
"type": "string", | |||
"enum": [ | |||
"USD" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you make a specific currencies file for this similar to status
https://github.com/balanced/balanced-api/blob/master/fixtures/_models/status.json
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will eventually, this is changing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, I just realized how long and unyielding that had become
All the currencies may come back at some point.
I'm not happy with |
should that does not hold true for transfers however... |
Right, the problem with |
how about having an object of the relevant currencies, something like
that seems somewhat awkward now that I have written it, but I think it might be nice to limit the number of top level fields on any resource |
i was going down the same path as you matthew, but agreed it feels odd. @steveklabnik is this considered a backwards compatible change? i ask because tho the fields you're proposing are additional so far and there are no existing changes, you can no longer say that that escrow = sum(debits.amount) - sum(refunds.amount) - sum(credits.amount) + sum(reversals.amount). |
my understanding is that this change is suppose to be compatible with rev1.1. That said, even if it was setup as not backwards compatible, I don't think people operating in a single currency should have to deal with the awkwardness of multi currency |
Orders already made that not true, right, @mjallday ? |
So, after discussing this with @mjallday , we should just make sure that this is clear to those who implement forex. It's still going to be backwards compatible, because until you do forex stuff, that's the same, and it's not a property we've ever explicitly guaranteed, but we should be careful about casually mentioning it. |
Updated this to use a currency reference so things don't get out of hand, as well as the full list of currencies, and renamed the two new fields to refer to 'captured' currency, since 'orders' was kinda confusing. Still not 100% happy with that name, but it's good enough. |
"minimum": 1 | ||
}, | ||
"captured_currency": { | ||
"$ref": "_models/currency.json" | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How is captured_currency
different from currency
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
currency
is your base currency (currently this will be USD for all accounts/escrows). captured_currency
is the amount you captured in. e.g. you capture in 1EUR with an exchange rate of 1.2 you would see
- currency: USD
- amount: 120
- captured_currency: EUR
- amount_in_captured_currency: 100
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently, currency
is denominated in cents. Will captured_currency
be also denominated the same way?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, if both currency
and captured_currency
are both USD, will amount_in_captured_currency
be the same as amount
or will it be null?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, integers of the smallest value of the currency.
They'll be the same. null
is evil!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kyungmin and I have come to the conclusion that since this information basically doesn't ever change, it will go in the documentation, and we'll provide some sample JavaScript to make it even easier to format correctly. Adding that information to the response just leads to sending the same information over the wire over and over again for little benefit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@matin noted. I struggled to come up with the right word here, and I guess I was wrong. Do you have any suggestions for what the right term is?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about this?
{
"amount": 10000,
"currency": "EUR",
"amount_in": {
"USD": 13755
}
}
The response can include whatever currencies are relevant for that marketplace.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The other alternative I would suggest is amount_in_escrow_currency
and escrow_currency
. This is consistent with the language we use elsewhere.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. Let's go with amount_in_escrow_currency
and escrow_currency
. I don't recall why I had an issue with that before, seems incredibly straightforward.
This pull request will eventually fulfill the "Forex" milestone: https://github.com/balanced/balanced-api/issues?milestone=9&state=open
This is the very first step: debiting a card in €.
There are two things left to do before this is 'ready':