v1

latestOpenAPI 3.0.02026-07-26168846732.2 KB
Payment Method Session

Payment Method Session - Create

Create a payment method session for a customer This is used to list the saved payment methods for the customer The customer can also add a new payment method using this session

post/v1/payment-method-sessions

Headers

X-Profile-Idstring required

Profile ID associated to the payment method session

Request body

customer_idstring nullable

The customer id for which the payment methods session is to be created

return_urlstring nullable

The return url to which the customer should be redirected to after adding the payment method

expires_ininteger nullable

The time (seconds ) when the session will expire If not provided, the session will expire in 15 minutes

{"stackTrail":"components:schemas:PaymentMethodSessionRequest:properties:tokenization_data","oasType":"schema","type":"unknown","description":"Contains data to be passed on to tokenization service ( if present ) to create token_id for given JSON data","nullable":true}
storage_type'volatile' | 'persistent' required
keep_aliveboolean nullable

Whether the card with new status should be listed in the session

Example request

{
  "customer_id": "cus_y3oqhf46pyzuxjbcn2giaqnb44",
  "billing": {
    "address": {
      "city": "New York",
      "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"
    }
  },
  "expires_in": 900
}

Response

Create the payment method session

idstring required
customer_idstring nullable

The customer id for which the payment methods session is to be created

{"stackTrail":"components:schemas:PaymentMethodSessionResponse:properties:tokenization_data","oasType":"schema","type":"unknown","description":"Contains data to be passed on to tokenization service ( if present ) to create token_id for given JSON data","nullable":true}
expires_atstring 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

client_secretstring required

Client Secret

return_urlstring nullable

The return url to which the user should be redirected to

associated_token_idstring nullable

The token-id created if there is tokenization_data present

storage_type'volatile' | 'persistent' required
sdk_authorizationstring nullable

SDK authorization token for client SDK usage Contains encoded authentication details for subsequent API calls

keep_aliveboolean required

Whether the card with new status should be listed in the session

Example response

{
  "id": "0a_pms_01926c58bc6e77c09e809964e72af8c8",
  "customer_id": "0a_cus_01926c58bc6e77c09e809964e72af8c8",
  "billing": {
    "address": {
      "city": "New York",
      "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"
    }
  },
  "expires_at": "2023-01-18T11:04:09.922Z",
  "client_secret": "cs_9wcXDRVkfEtLEsSnYKgQ",
  "return_url": "https://merchant-website.com/return",
  "next_action": {
    "redirect_to_url": "https://example.com/redirect"
  },
  "authentication_details": {
    "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": {
        "data": "token_9wcXDRVkfEtLEsSnYKgQ"
      }
    }
  ],
  "associated_token_id": "0a_tok_01926c58bc6e77c09e809964e72af8c8",
  "card_cvc_token_storage": {
    "is_stored": true,
    "expires_at": "2024-02-24T11:04:09.922Z"
  },
  "payment_method_data": {
    "card": {
      "last4_digits": "4242",
      "expiry_month": "10",
      "expiry_year": "25",
      "card_holder_name": "John Doe",
      "card_fingerprint": "fingerprint_12345",
      "nick_name": "Card",
      "card_isin": "4567890",
      "card_issuer": "Issuer Bank",
      "card_type": "Credit",
      "saved_to_locker": true
    }
  },
  "sdk_authorization": "cHJvZmlsZV9pZD0uLi4=",
  "network_tokenization_data": {
    "payment_method_data": {
      "last4_digits": "4242",
      "network_token_expiry_month": "05",
      "network_token_expiry_year": "27",
      "nick_name": "Card",
      "card_holder_name": "John Doe",
      "card_isin": "16712672",
      "card_issuer": "Bank of America",
      "card_type": "Credit",
      "par": "522134KAVJ1JPZ8L77N0Z2LRYZS7J"
    }
  }
}