Skip to content

fix: map non-prefixed payment method IDs in Transak translation#8980

Merged
meltingice1337 merged 2 commits into
mainfrom
fix/TRAM-3610
Jun 3, 2026
Merged

fix: map non-prefixed payment method IDs in Transak translation#8980
meltingice1337 merged 2 commits into
mainfrom
fix/TRAM-3610

Conversation

@meltingice1337
Copy link
Copy Markdown
Contributor

@meltingice1337 meltingice1337 commented Jun 3, 2026

Explanation

Transak Native deposits were failing on staging/UAT with a 400 response and the error message paymentMethod is required parameter.

The root cause is in TransakService.normalizePaymentMethodForTranslation (in @metamask/ramps-controller). The translation endpoint only understands deposit-format payment method IDs (e.g. apple_pay), so the service maps canonical ramps IDs to that format via the RAMPS_TO_DEPOSIT_PAYMENT_METHOD lookup. However, that lookup was keyed only on the /payments/-prefixed form (e.g. /payments/apple-pay). When a canonical ID arrived without the prefix (e.g. apple-pay), it missed the map and was forwarded to the translation endpoint unchanged. The endpoint doesn't recognize that value, returns no usable paymentMethod, and the downstream deposit call fails with paymentMethod is required parameter.

The fix updates normalizePaymentMethodForTranslation to accept both forms: before falling back to passing the input through untouched, it now also tries the /payments/-prefixed variant of the input against the lookup. So both apple-pay and /payments/apple-pay resolve to apple_pay, while values already in deposit format (e.g. credit_debit_card) still pass through unchanged.

This helper feeds every Transak translation call (getBuyQuote, createOrder, getUserLimits, confirmPayment, getTranslation), so the fix applies uniformly across the deposit flow. The change is purely additive — it only broadens the set of accepted inputs and does not alter behavior for inputs that already worked, so it is not a breaking change.

Before:

ScreenRecording_06-03-2026.11-09-06_1.mp4

After:

ScreenRecording_06-03-2026.11-06-27_1.mp4

References

  • Fixes TRAM-3610
  • Follow-up (separate, in the mobile app repo): bump @metamask/ramps-controller to adopt this fix.

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've communicated my changes to consumers by updating changelogs for packages I've changed
  • I've introduced breaking changes in this PR and have prepared draft pull requests for clients and consumer packages to resolve them

Note

Low Risk
Small, additive lookup change in payment method normalization with tests; no auth or breaking API changes.

Overview
Fixes Transak Native deposits on staging/UAT that failed with paymentMethod is required parameter when callers passed canonical payment method IDs without the /payments/ prefix (e.g. apple-pay).

normalizePaymentMethodForTranslation in TransakService now resolves both unprefixed and /payments/… canonical IDs to deposit-format values (e.g. apple_pay) before the native translate call; prefixed inputs and values already in deposit format behave as before. A unit test covers the unprefixed case; the changelog documents the fix.

Reviewed by Cursor Bugbot for commit c4a1c57. Bugbot is set up for automated code reviews on this repo. Configure here.

@meltingice1337 meltingice1337 requested review from a team as code owners June 3, 2026 08:16
@meltingice1337 meltingice1337 added this pull request to the merge queue Jun 3, 2026
Merged via the queue into main with commit 3c2d39f Jun 3, 2026
370 checks passed
@meltingice1337 meltingice1337 deleted the fix/TRAM-3610 branch June 3, 2026 12:47
@meltingice1337 meltingice1337 mentioned this pull request Jun 3, 2026
4 tasks
pull Bot pushed a commit to Reality2byte/core that referenced this pull request Jun 3, 2026
## Explanation

This is a release PR for `@metamask/ramps-controller@14.1.1` (monorepo
release `1018.0.0`).

It releases a single bug fix: Transak Native deposits were failing on
staging/UAT with a 400 `paymentMethod is required parameter` error. The
Transak translation layer only mapped payment method IDs supplied with
the `/payments/` prefix (e.g. `/payments/apple-pay`); canonical,
non-prefixed IDs (e.g. `apple-pay`) were not mapped to their
deposit-format equivalents and were rejected. This change maps the
non-prefixed forms in addition to the prefixed forms.

`packages/transaction-pay-controller/package.json` has its
`@metamask/ramps-controller` dependency range bumped from `^14.1.0` to
`^14.1.1` to track the new version; `transaction-pay-controller` itself
is not being re-released.

## References

- Fixes the Transak Native deposit 400 error introduced by missing
non-prefixed payment method mapping (see
[MetaMask#8980](MetaMask#8980)).

## Checklist

- [x] I've updated the test suite for new or updated code as appropriate
- [x] I've updated documentation (JSDoc, Markdown, etc.) for new or
updated code as appropriate
- [x] I've communicated my changes to consumers by [updating changelogs
for packages I've
changed](https://github.com/MetaMask/core/tree/main/docs/processes/updating-changelogs.md)
- [ ] I've introduced [breaking
changes](https://github.com/MetaMask/core/tree/main/docs/processes/breaking-changes.md)
in this PR and have prepared draft pull requests for clients and
consumer packages to resolve them

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Low Risk**
> Version and changelog-only release PR; the functional fix is a narrow
Transak deposit payment-method mapping patch already described in
14.1.1.
> 
> **Overview**
> Monorepo release **1018.0.0** publishes
**`@metamask/ramps-controller@14.1.1`**, documenting a patch that fixes
Transak Native deposits returning **400** `paymentMethod is required
parameter` when callers pass canonical payment method IDs **without**
the `/payments/` prefix (e.g. `apple-pay`), not only prefixed IDs like
`/payments/apple-pay`.
> 
> This PR’s diff is **release bookkeeping only**: root and package
version bumps, **`ramps-controller`** changelog section **14.1.1**, and
**`transaction-pay-controller`**’s dependency on
**`@metamask/ramps-controller`** updated from `^14.1.0` to `^14.1.1`
(plus **`yarn.lock`**). **`transaction-pay-controller`** is not
version-bumped here.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
221c37b. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

---------

Co-authored-by: Darius Costolas <10818970+meltingice1337@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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.

2 participants