Create Token

Tokenizes a payment card and its billing address so the card can be charged later without transmitting raw card data again. Use this endpoint to support saved payment methods, card on file billing, and repeat purchases while reducing PCI scope.

Warning: network_token_data is returned only when network tokenization is enabled for your account. Contact SoftPoint to have this feature enabled before integrating against the network token response fields.

Request Headers

HeaderRequiredDescription
AuthorizationYesBearer YOUR_ACCESS_TOKEN
Content-TypeYesapplication/json

Request Parameters

Path Parameters

ParameterTypeRequiredDescription
location_idstringYesIdentifier of the location.

Request Body Fields

FieldTypeRequiredDescription
user_idstringYesIdentifier of the customer the token belongs to.
currency_isostringYesISO currency code, for example USD.
phone_numberstringNoCustomer phone number.
msisdnstringNoMobile subscriber number associated with the customer.
country_isostringNoISO country code for the customer.
card_dataobjectYesCard details to tokenize.
card_data.panstringYesCard primary account number. Must not exceed 16 digits.
card_data.exp_monthstringYesCard expiration month, two digits.
card_data.exp_yearstringYesCard expiration year, two digits.
card_data.card_holderstringYesName of the cardholder.
card_data.card_typestringNoCard brand, for example Visa.
billing_addressobjectNoBilling address associated with the card.
billing_address.streetstringNoStreet address.
billing_address.street_2stringNoSecondary address line.
billing_address.zipstringNoPostal code.
billing_address.citystringNoCity.
billing_address.statestringNoState or region.
billing_address.emailstringNoEmail address for the billing contact.

Request Example

{
  "user_id": "5001",
  "currency_iso": "USD",
  "phone_number": "9825065185",
  "country_iso": "US",
  "card_data": {
    "pan": "4111111111111111",
    "exp_month": "10",
    "exp_year": "30",
    "card_holder": "John Doe"
  },
  "billing_address": {
    "street": "516 Pine Dr",
    "street_2": "Street 2",
    "zip": "50020",
    "city": "boston",
    "state": "CA",
    "email": "[email protected]"
  }
}

cURL Example

curl --request POST \
  --url https://sandbox-gtw.softpoint.io/api/locations/YOUR_LOCATION_ID/tokens \
  --header "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  --header "Content-Type: application/json" \
  --data '{
    "user_id": "5001",
    "currency_iso": "USD",
    "country_iso": "US",
    "card_data": {
      "pan": "4111111111111111",
      "exp_month": "10",
      "exp_year": "30",
      "card_holder": "John Doe"
    },
    "billing_address": {
      "street": "516 Pine Dr",
      "zip": "50020",
      "city": "boston",
      "state": "CA",
      "email": "[email protected]"
    }
  }'

Success Response

{
  "network_token_data": {
    "token": "4895370019917092",
    "exp_month": "12",
    "exp_year": "34",
    "card_network": "visa",
    "state": "ACTIVE"
  },
  "servicefee_amount": 0,
  "surcharge_amount": 0,
  "tip_amount_approved": 0,
  "conveniencefee_amount": 0,
  "authcode": "016150703802094",
  "approvalCode": "831000",
  "networkTransactionId": "016150703802094",
  "reference_id": "",
  "currency_iso": "USD",
  "inv_number": "",
  "networkReconciliationId": "L3MHGQW5W1MG",
  "avsCode": "Y",
  "avsCodeRaw": "Y",
  "cardVerification": "",
  "cardVerificationRaw": "",
  "transaction_id": "756F11F1-E1E1-4724-A0D8-D05099D6021D",
  "transaction_no": "016150703802094",
  "card_data": {
    "token": "GRYfiyggFSBV0670",
    "cardfullname": "John Doe",
    "expiry_information": "10/30",
    "last4": "0670",
    "card_brand": "Visa"
  }
}

Response Fields

FieldTypeDescription
network_token_dataobjectNetwork token information returned when network tokenization is enabled, contact SoftPoint to enable it.
network_token_data.tokenstringNetwork token (DPAN) issued by the card network.
network_token_data.exp_monthstringNetwork token expiration month in MM format.
network_token_data.exp_yearstringNetwork token expiration year in YY format.
network_token_data.card_networkstringCard network associated with the network token, for example visa.
network_token_data.statestringCurrent status of the network token, for example ACTIVE.
servicefee_amountnumberService fee amount applied to the transaction.
surcharge_amountnumberSurcharge amount applied to the transaction.
tip_amount_approvednumberApproved tip amount.
conveniencefee_amountnumberConvenience fee amount applied to the transaction.
authcodestringAuthorization code returned during tokenization.
approvalCodestringApproval code returned by the processor.
networkTransactionIdstringNetwork transaction identifier assigned by the card network.
reference_idstringReference identifier, when present.
currency_isostringCurrency associated with the token.
inv_numberstringInvoice number associated with the transaction, when provided.
networkReconciliationIdstringIdentifier used by the card network for reconciliation.
avsCodestringNormalized Address Verification Service (AVS) result code.
avsCodeRawstringRaw AVS response code returned by the processor.
cardVerificationstringNormalized card verification (CVV/CVC) result code, when available.
cardVerificationRawstringRaw card verification response code returned by the processor.
transaction_idstringIdentifier of the tokenization transaction.
transaction_nostringGateway transaction number.
card_dataobjectTokenized card summary.
card_data.tokenstringThe gateway token representing the stored card. Use this value for future card-on-file transactions.
card_data.cardfullnamestringCardholder name.
card_data.expiry_informationstringCard expiry in MM/YY format.
card_data.last4stringLast four digits of the card.
card_data.card_brandstringCard brand.

Error Responses

Validation Error

Returned when the card number exceeds the permitted length.

{
  "message": "The card data.pan field must not have more than 16 digits.",
  "errors": {
    "card_data.pan": [
      "The card data.pan field must not have more than 16 digits."
    ]
  }
}

Status Codes

CodeDescription
200Token created successfully.
401Missing or invalid access token.
422Validation failed, for example an invalid PAN length.

Workflow Placement

Create Token enables card-on-file processing:

  1. Generate a gateway access token.

  2. Tokenize the card with this endpoint.

  3. Use the returned token in Sale or Authorize, or manage it through Get, Update, and Delete Token.

Notes

  • The gateway token is returned in card_data.token. Persist this value to charge the card later.

  • When available, network_token_data contains the network token (DPAN) and its metadata returned by the card network. This information is provided for reference and network token lifecycle management.

  • The PAN must not exceed 16 digits, or the request is rejected with HTTP 422.

  • Validation errors on this endpoint use a message and errors structure rather than the standard error envelope.

Common Mistakes

  • Submitting a PAN longer than 16 digits.

  • Confusing the gateway token (card_data.token) with the network token (network_token_data.token). The gateway token should be used for subsequent API requests unless your integration specifically requires the network token.

  • Expecting the standard error envelope for validation failures, which instead use message and errors.

  • Failing to persist the returned gateway token, which is required for subsequent charges.


Path Params
string
required
Body Params
Responses

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