Skip to content

Conversation

@dmatviichuk
Copy link

@dmatviichuk dmatviichuk commented Dec 8, 2025

…irm response

Type of Change

  • Bugfix
  • New feature
  • Enhancement
  • Refactoring
  • Dependency updates
  • Documentation
  • CI/CD

Description

Include the payment_method_id in the response returned by the payment-method-sessions/confirm endpoint.
Fixes #10573

Additional Changes

  • This PR modifies the API contract
  • This PR modifies the database schema
  • This PR modifies application configuration/environment variables

Motivation and Context

The /v2/payment-method-sessions/{id}/confirm endpoint returns associated_payment_methods containing temporary Redis tokens (e.g., "token_KpNynVfRrSoFound1nec"). These are for internal web SDK use and cannot be used with the proxy endpoint or other APIs that require permanent identifiers.
The proxy endpoint requires:
token_type: "payment_method_id" with a permanent payment method ID (e.g., 12345_pm_...)
token_type: "tokenization_id" with a tokenization ID (e.g., 12345_tok_...)
Since a payment method is created during session confirmation, we should include the permanent payment_method_id in the response so it can be used with the proxy endpoint and other APIs.
Use case:
After confirming a payment method session, users can now use associated_payment_method_id in the proxy endpoint:
{ "token": "12345_pm_01926c58bc6e77c09e809964e72af8c8", "token_type": "payment_method_id"}

This change is backward compatible as the new field is optional and doesn't break existing clients.

How did you test it?

image

Checklist

  • I formatted the code cargo +nightly fmt --all
  • I addressed lints thrown by cargo clippy
  • I reviewed the submitted code
  • I added unit tests for my changes where possible

@dmatviichuk dmatviichuk requested a review from a team as a code owner December 8, 2025 23:43
@semanticdiff-com
Copy link

semanticdiff-com bot commented Dec 8, 2025

Review changes with  SemanticDiff

Changed Files
File Status
  crates/api_models/src/payment_methods.rs  0% smaller
  crates/router/src/core/payment_methods.rs  0% smaller
  crates/router/src/core/payment_methods/transformers.rs  0% smaller

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.

[FEATURE] Include the payment_method_id in the response returned by the payment-method-sessions/confirm endpoint

1 participant