Card session (iframe token, tokenize)

This API is used to start saving a card: it returns what the SoftPoint iframe needs to tokenize the card in the browser.

Load the iframe with location_id and access_token in tokenize mode (process_type: tokenize, store-card: 1). The iframe returns a card token; send it to Save card.

Note: The location's card processor must be configured. The access_token is a short-lived gateway token: request a new session for each attempt.

URL

{{interface_url}}/{{version}}/customers/{{customer_id}}/payment-methods/card-session

Method

POST

Headers

Authorization: Bearer {access_token} (or Api-Key)

Request Parameters

FieldTypeRequiredDescription
location_idIntegerConditionalLocation to use. Required when the token covers more than one location (corporate / sub corporate); with a location token it is taken from the token.

URL Parameters

ParameterRequired/OptionalTypeDescription
customer_idRequiredIntegerOur customer ID (id returned by Create customer).

Example Request (cURL)

curl --location --request POST '{{interface_url}}/{{version}}/customers/{{customer_id}}/payment-methods/card-session' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {{access_token}}' \
--data '{
  "location_id": 279685
}'

Example Response (JSON) — 200

{
  "location_id": 279685,
  "access_token": "eyJ0eXAiOiJKV1Qi...",
  "environment": "sandbox",
  "iframe": {
    "process_type": "tokenize",
    "store_card": 1
  },
  "customer_id": 48213
}

Error Responses

Format: { "error": { "code", "name", "message", "details" } }

StatusErrorWhen
404customer_not_foundThe customer is not linked to that location.
422processor_configuration_not_foundThe location has no card processor.
502gateway_unavailableThe gateway did not answer. Retry.

Path Params
string
required
string
required
Body Params
Response

Language
LoadingLoading…
Response
Click Try It! to start a request and see the response here! Or choose an example:
application/json