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

feat(payments-plugin): Add multi currency support for braintree plugin #3218

Open
kkerti opened this issue Nov 20, 2024 · 0 comments
Open

feat(payments-plugin): Add multi currency support for braintree plugin #3218

kkerti opened this issue Nov 20, 2024 · 0 comments

Comments

@kkerti
Copy link
Contributor

kkerti commented Nov 20, 2024

Is your feature request related to a problem? Please describe.
Vendure got first class support for handling multiple currencies, languages all within a single channel. Although for most shops operating in the EU the most common currency will be EUR, there are dozen other currencies which can be offered during checkout for a better customer experience. Our own shop also uses a multi-currency setup and while migrating to vendure realized that the built-in braintree integration doesn't support this.

Describe the solution you'd like
We have implemented in our previous commerce stack the braintree API and used a small helper function to set the correct MERCHANT_ID during runtime, based on currency.

function setMerchantAccountId(currency: string) {
  if (currency) {
    let merchantAccountId: string = '';
    switch (currency.toLowerCase()) {
      case 'usd':
        merchantAccountId = process.env['BT_MERCHANT_ACCOUNT_ID_USD']!;
        break;
      case 'eur':
        merchantAccountId = process.env['BT_MERCHANT_ACCOUNT_ID_EUR']!;
        break;
      default:
        merchantAccountId = process.env['BT_MERCHANT_ACCOUNT_ID_USD']!;
    }
    return merchantAccountId;
  } else {
    throw Error('Currency is not set!')
  }
}

This merchantAccountId is then used in function calls against the BraintreeGateway.

Describe alternatives you've considered
Stripe supports multi currency out-of-box. From braintree, we are using PayPal right now only and use it as a backup to reduce risk using only one payment provider. I think multi-currency support should be included in the braintree payments plugin.

Additional context
I started to work on this.

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

No branches or pull requests

1 participant