juspay / hyperswitch

An open source payments switch written in Rust to make payments fast, reliable and affordable
https://hyperswitch.io/
Apache License 2.0
12.57k stars 1.35k forks source link

[BUG] `payment_method` not found error when trying to make a payment using a payment token #1361

Open vspecky opened 1 year ago

vspecky commented 1 year ago

Bug Description

The application throws a payment_method not found error when trying to make a payment using a payment token. The payment token is updated from the "list payment methods for customer" API.

Expected Behavior

The application should use the payment token to fetched the saved payment details from the vault.

Actual Behavior

The application throws an error saying the payment_method was not found.

Steps To Reproduce

  1. Create a merchant account
  2. Create a connector account
  3. Make a card payment with setup_future_usage=on_session and a customer ID so the card gets saved.
  4. List the payment methods for the customer ID and get the payment token for the previously used payment method.
  5. Use this token for making another payment (with no explicit payment details passed, just the token)

Context For The Bug

  2023-06-06T11:27:13.456264Z ERROR router::services::api: error: {"error":{"type":"invalid_request","message":"Missing required param: payment_method","code":"IR_04"}}
├╴at crates/router/src/services/api.rs:556:55
│
╰─▶ {"error":{"type":"invalid_request_error","code":"IR_04","message":"Missing required param: payment_method"}}
    ├╴at crates/router/src/core/payments.rs:871:18
    ╰╴Missing required field payment_method in None
    at crates/router/src/services/api.rs:663

Environment

Are you using hyperswitch hosted version? No

If not (or if building/running locally), please provide the following details:

  1. Operating System or Linux distribution: MacOS
  2. Rust version (output of rustc --version): 1.69.0

Have you spent some time to check if this bug has been raised before?

Have you read the Contributing Guidelines?

Are you willing to submit a PR?

No, but I'm happy to collaborate on a PR with someone else

jeevaprakashdr commented 1 year ago

@vspecky I am interested in looking at this issue. Please can you assign this to me? @SanchithHegde just tagging if you can assign this to me.

vspecky commented 1 year ago

@vspecky I am interested in looking at this issue. Please can you assign this to me? @SanchithHegde just tagging if you can assign this to me.

@jeevaprakashdr Hey, unfortunately, this is a high priority task which would require a lot of domain knowledge as well as internal knowledge so we want someone from the internal team to pick it up ideally. Thanks for expressing interest tho!