Skip to content

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

@kkerti

Description

@kkerti

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestpayments-pluginRelated to the payments-plugin package

    Projects

    Status

    👀 Under consideration

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions