Skip to main content
PUT
/
v1
/
payment-method-sessions
/
{id}
/
update-saved-payment-method
Payment Method Session - Update a saved payment method
curl --request PUT \
  --url https://sandbox.hyperswitch.io/v1/payment-method-sessions/{id}/update-saved-payment-method \
  --header 'Authorization: <api-key>' \
  --header 'Content-Type: application/json' \
  --header 'X-Profile-Id: <x-profile-id>' \
  --data '
{
  "payment_method_data": {
    "card": {
      "card_cvc": "456",
      "card_holder_name": "Narayan Bhat"
    }
  },
  "payment_method_token": "token_9wcXDRVkfEtLEsSnYKgQ"
}
'
{
  "id": "12345_pms_01926c58bc6e77c09e809964e72af8c8",
  "expires_at": "2023-01-18T11:04:09.922Z",
  "client_secret": "cs_9wcXDRVkfEtLEsSnYKgQ",
  "customer_id": "12345_cus_01926c58bc6e77c09e809964e72af8c8",
  "billing": {
    "address": {
      "city": "New York",
      "country": "AF",
      "line1": "123, King Street",
      "line2": "Powelson Avenue",
      "line3": "Bridgewater",
      "zip": "08807",
      "state": "New York",
      "first_name": "John",
      "last_name": "Doe",
      "origin_zip": "08807"
    },
    "phone": {
      "number": "9123456789",
      "country_code": "+1"
    },
    "email": "<string>"
  },
  "psp_tokenization": {
    "tokenization_type": "single_use",
    "connector_id": "mca_28a7367sad8239s67"
  },
  "network_tokenization": {
    "enable": "Enable"
  },
  "tokenization_data": "<unknown>",
  "return_url": "https://merchant-website.com/return",
  "next_action": {
    "redirect_to_url": "https://example.com/redirect",
    "type": "redirect_to_url"
  },
  "authentication_details": {
    "status": "succeeded",
    "error": {
      "code": "card_declined",
      "message": "The card was declined.",
      "reason": "The card was declined.",
      "unified_code": "card_declined",
      "unified_message": "The card was declined.",
      "network_advice_code": "01",
      "network_decline_code": "05",
      "network_error_message": "Do not retry"
    }
  },
  "associated_payment_methods": [
    {
      "payment_method_token": {
        "type": "payment_method_session_token",
        "data": "token_9wcXDRVkfEtLEsSnYKgQ"
      }
    }
  ],
  "associated_token_id": "12345_tok_01926c58bc6e77c09e809964e72af8c8",
  "storage_type": "volatile",
  "card_cvc_token_storage": {
    "is_stored": true,
    "expires_at": "2024-02-24T11:04:09.922Z"
  },
  "payment_method_data": {
    "card": {
      "saved_to_locker": true,
      "issuer_country": "AF",
      "last4_digits": "4242",
      "expiry_month": "10",
      "expiry_year": "25",
      "card_holder_name": "John Doe",
      "card_fingerprint": "fingerprint_12345",
      "nick_name": "Card",
      "card_network": "Visa",
      "card_isin": "4567890",
      "card_issuer": "Issuer Bank",
      "card_type": "Credit"
    }
  }
}

Authorizations

Authorization
string
header
required

Format: publishable-key=<publishable-key>,client-secret=<client-secret>

Publishable keys are a type of keys that can be public and have limited scope of usage. Client Secret provide temporary access to singular data, such as access to a single customer object for a short period of time. This authentication scheme is used by the SDK.

Headers

X-Profile-Id
string
required

Profile ID associated to the payment method session

Path Parameters

id
string
required

The unique identifier for the Payment Method Session

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
connector_token_details
object

Token information that can be used to initiate transactions by the merchant.

network_transaction_id
string | null

The network transaction ID provided by the card network during a Customer Initiated Transaction (CIT) when setup_future_usage is set to off_session.

Response

The payment method has been updated successfully

id
string
required
Example:

"12345_pms_01926c58bc6e77c09e809964e72af8c8"

expires_at
string<date-time>
required

The iso timestamp when the session will expire Trying to retrieve the session or any operations 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 to be created

Example:

"12345_cus_01926c58bc6e77c09e809964e72af8c8"

billing
object
psp_tokenization
object

The Payment Service Provider Configuration for payment methods that are created using the payment method session

network_tokenization
object

The network tokenization configuration for creating the payment method session

tokenization_data
any | null

Contains data to be passed on to tokenization service ( if present ) to create token_id for given JSON data

return_url
string | null

The return url to which the user should be redirected to

Example:

"https://merchant-website.com/return"

next_action
object

Contains the url for redirection flow

authentication_details
object
associated_payment_methods
object[] | null

The payment method that was created using this payment method session

associated_token_id
string | null

The token-id created if there is tokenization_data present

Example:

"12345_tok_01926c58bc6e77c09e809964e72af8c8"

storage_type
enum<string>
Available options:
volatile,
persistent
card_cvc_token_storage
object
payment_method_data
object