Payment Method Session - Update a saved payment method

PUT /v2/payment-method-sessions/{id}/update-saved-payment-method

Updates a saved payment method within a Payment Method Session.

cURL

curl
curl --request PUT \
  --url https://sandbox.hyperswitch.io/v2/payment-method-sessions/{id}/update-saved-payment-method \
  --header 'Content-Type: application/json' \
  --header 'api-key: <api-key>' \
  --data '
{
  "payment_method_data": {
    "card": {
      "card_cvc": "456",
      "card_holder_name": "Narayan Bhat"
    }
  },
  "payment_method_token": "token_9wcXDRVkfEtLEsSnYKgQ"
}
'

Example success response (200)

Authorizations

  • Header: api-key (string, required) Ephemeral keys provide temporary access to singular data, such as access to a single customer object for a short period of time.

Path parameters

  • id (string, required) — The unique identifier for the Payment Method Session

Request body (application/json)

  • payment_method_token (string, required) — The payment method token associated with the payment method session Example: "token_9wcXDRVkfEtLEsSnYKgQ"

  • payment_method_data (object) — Details to update on the payment method (e.g., card information)

    • connector_token_details (object) — Token information that can be used to initiate transactions by the merchant.

Response (200 — application/json)

The payment method has been updated successfully. Response fields include:

  • id (string, required) Example: "12345_pms_01926c58bc6e77c09e809964e72af8c8"

  • expires_at (string, date-time, required) — ISO timestamp when the session will expire. Trying to retrieve or operate on the session after this time will result in an error. Example: "2023-01-18T11:04:09.922Z"

  • client_secret (string, required) — Client Secret Example: "cs_9wcXDRVkfEtLEsSnYKgQ"

  • customer_id (string | null) — The customer id for which the payment methods session is created Example: "12345_cus_01926c58bc6e77c09e809964e72af8c8"

  • billing (object) — Billing details (address, phone, email)

  • psp_tokenization (object) — Payment Service Provider configuration for payment methods created using the session

  • network_tokenization (object) — Network tokenization configuration for the session

  • tokenization_data (any | null) — Data to pass to tokenization service to create token_id (if present)

  • return_url (string | null) — URL to which the user should be redirected after completion Example: "https://merchant-website.com/return"

  • next_action (object) — Contains the URL for redirection flow (e.g., redirect_to_url)

  • authentication_details (object) — Authentication status and error details (if any)

  • associated_payment_methods (object[] | null) — Payment methods created using this payment method session

  • associated_token_id (string | null) — Token id created if tokenization_data is present Example: "12345_tok_01926c58bc6e77c09e809964e72af8c8"

  • storage_type (enum) — Available options: volatile, persistent

  • card_cvc_token_storage (object) — Details about CVC token storage (is_stored, expires_at)