Skip to content
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

Improve withdrawal flow on wallets that enable cross-border payments #404

Merged
merged 7 commits into from
Sep 17, 2019

Conversation

accordeiro
Copy link
Member

This PR fixes #395. It aims to:

  • Emphasize the importance of accepting an amount value as a parameter in both /withdraw and the interactive flow URL
  • Point out that anchors need to be flexible about the informed amount vs. what is actually transferred to their Stellar accounts (a 10% margin might be a good start)
  • Instruct anchors to watch for other types of payment operations besides payment

I'm still a bit unsure whether I've made changes in the right places, since we now have the Basic Implementation recommendations and the actual specs.

@msfeldstein @tomerweller @tomquisel please let me know your thoughts.

@accordeiro accordeiro self-assigned this Sep 16, 2019
@accordeiro accordeiro changed the title Improve withdraw flow on wallets that enable cross-border payments Improve withdrawal flow on wallets that enable cross-border payments Sep 16, 2019
@@ -420,7 +424,7 @@ The wallet must use the response fields in the following way to complete the wit
- `withdraw_anchor_account`: send the withdrawal payment to this Stellar account.
- `withdraw_memo`: (if specified) use this memo in the payment transaction to the anchor.
- `withdraw_memo_type`: use this as the memo type.
- `amount_in`: the amount expected in the stellar payment.
- `amount_in`: the amount expected in the Stellar payment (with an acceptable error margin of 10%)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The amount_in should never fluctuate right? Only the amount that actually ends up sent? The error margin here is confusing.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I agree it's confusing. I wanted to make it clear for wallets that there is an acceptable error margin, but this is probably not the spot. I'll push a change to address this shortly.

* We recommend you use [SEP-10 authentication](#authentication) in the interactive flow and do not separately prompt for password to achieve a good user experience (although asking for MFA when confirming a transaction or requiring email confirmation is reasonable). Be sure to accept the [`jwt` parameter](#adding-parameters-to-the-url) so the user does not have to re-login. Support the `callback` parameter as well.
* Test your interactive flows on mobile. They should be easy to use on all devices: make them responsive, handle auto-fill well, and do smart keyboard management on mobile devices.
* **Interactive deposit**
* Your interactive deposit popup will do everything needed to initiate the deposit without the user needing to interact with the wallet further. It should either directly initiate the deposit, or handle displaying information (such as reference number or bank account number) that the user will need to complete their deposit.
* **Interactive withdrawal**
* Your withdrawal flow will have to pass control back to the user's wallet, so it can initiate the withdrawal with a Stellar payment to your withdrawal address. You'll need to communicate the withdrawal address, amount and status to the wallet using the [`callback` parameter](#adding-parameters-to-the-url), and also by making it available on your `/transaction` endpoint. See [details](#guidance-for-wallets-completing-an-interactive-withdrawal).
* If an `amount` parameter is provided to the interactive URL, make sure to use that value to pre-populate the amount on the interactive form. This greatly improves the user experience, especially in wallets that enable cross-border payments.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove the reference to cross-border payments here

* We recommend you use [SEP-10 authentication](#authentication) in the interactive flow and do not separately prompt for password to achieve a good user experience (although asking for MFA when confirming a transaction or requiring email confirmation is reasonable). Be sure to accept the [`jwt` parameter](#adding-parameters-to-the-url) so the user does not have to re-login. Support the `callback` parameter as well.
* Test your interactive flows on mobile. They should be easy to use on all devices: make them responsive, handle auto-fill well, and do smart keyboard management on mobile devices.
* **Interactive deposit**
* Your interactive deposit popup will do everything needed to initiate the deposit without the user needing to interact with the wallet further. It should either directly initiate the deposit, or handle displaying information (such as reference number or bank account number) that the user will need to complete their deposit.
* **Interactive withdrawal**
* Your withdrawal flow will have to pass control back to the user's wallet, so it can initiate the withdrawal with a Stellar payment to your withdrawal address. You'll need to communicate the withdrawal address, amount and status to the wallet using the [`callback` parameter](#adding-parameters-to-the-url), and also by making it available on your `/transaction` endpoint. See [details](#guidance-for-wallets-completing-an-interactive-withdrawal).
* If an `amount` parameter is provided to the interactive URL, make sure to use that value to pre-populate the amount on the interactive form. This greatly improves the user experience, especially in wallets that enable cross-border payments.
* In order to fulfill a withdrawal, a wallet must make a payment to the Stellar address that the anchor provides. It is the anchor's job to watch for Stellar payments to the given address and make the external transaction as soon as they're detected. It is recommended for anchors to listen to at least `payment` and `path_payment` [operations](https://www.stellar.org/developers/horizon/reference/endpoints/payments-all.html), although supporting the remaining ones is important for covering all use cases.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is recommended for anchors to listen to at least payment and path_payment

Should we mention our SDKs do this for our /payment streaming endpoints already?

* We recommend you use [SEP-10 authentication](#authentication) in the interactive flow and do not separately prompt for password to achieve a good user experience (although asking for MFA when confirming a transaction or requiring email confirmation is reasonable). Be sure to accept the [`jwt` parameter](#adding-parameters-to-the-url) so the user does not have to re-login. Support the `callback` parameter as well.
* Test your interactive flows on mobile. They should be easy to use on all devices: make them responsive, handle auto-fill well, and do smart keyboard management on mobile devices.
* **Interactive deposit**
* Your interactive deposit popup will do everything needed to initiate the deposit without the user needing to interact with the wallet further. It should either directly initiate the deposit, or handle displaying information (such as reference number or bank account number) that the user will need to complete their deposit.
* **Interactive withdrawal**
* Your withdrawal flow will have to pass control back to the user's wallet, so it can initiate the withdrawal with a Stellar payment to your withdrawal address. You'll need to communicate the withdrawal address, amount and status to the wallet using the [`callback` parameter](#adding-parameters-to-the-url), and also by making it available on your `/transaction` endpoint. See [details](#guidance-for-wallets-completing-an-interactive-withdrawal).
* If an `amount` parameter is provided to the interactive URL, make sure to use that value to pre-populate the amount on the interactive form. This greatly improves the user experience, especially in wallets that enable cross-border payments.
* In order to fulfill a withdrawal, a wallet must make a payment to the Stellar address that the anchor provides. It is the anchor's job to watch for Stellar payments to the given address and make the external transaction as soon as they're detected. It is recommended for anchors to listen to at least `payment` and `path_payment` [operations](https://www.stellar.org/developers/horizon/reference/endpoints/payments-all.html), although supporting the remaining ones is important for covering all use cases.
* When the wallet is exchanging relatively unstable currencies, there might be slight fluctuations on value between the informed withdrawal `amount` and the actual transferred amount. It is recommended for anchors to accept an amount fluctuation of up to ±10%, and adjust the amount to be transferred (and fees) to reflect the actual value received.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to make this section a little clearer that the unstable currencies isn't something the anchor needs to worry about, but they should expect that the amount requested to withdraw might not be the exact amount they receive, and they should be flexible.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer to say "Some wallets might..." to be clear that this isn't something that always happens, and just a feature some wallets add

@@ -102,6 +102,7 @@ SEP-6 lays out many options for how deposit and withdrawal can work. These are r
* Provide an interface to the user that allows them to view the withdrawal details including the computed fee. The user can confirm and then the wallet will initiate the withdrawal by sending the Stellar payment to the address provided by the issuer.
* If the anchor responds with an interactive flow, handle it as [described in detail](#3-customer-information-needed-interactive).
* For now, do not handle the non-interactive or status responses to the `/withdraw` request.
* For wallets that enable cross-border payments: exchange rate fluctuations might require withdrawal values to slightly vary from the originally provided `amount`. Anchors are instructed to accept a variation of ±10% between the informed `amount` and the actual value sent to the anchor's Stellar account. The withdrawn amount will be adjusted accordingly.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make the same type of "Some wallets" change here too and we should be good to go

@msfeldstein msfeldstein merged commit ddd7a1f into master Sep 17, 2019
@msfeldstein msfeldstein deleted the accordeiro/sep6-cbp branch September 17, 2019 19:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Withdraw flow issues on wallets that enable cross-border payments
2 participants