/tokenize

The Payment Method information sent through /evaluate must first be tokenized.

Try it right now:


Request

Query parameters

Tokenization endpointThe endpoint to manage PCI data for /evaluate. Get this endpoint.
midYour FlexCharge Merchant Identification Number. Get your Mid
EnvironmentYour unique Tokenization key. Get your key.

Log into into your Sandbox. Go to section Developers > Tokenization get both your Tokenization endpoint and Environment.


Body parameters

Required fields

payment.MethodObjectRequiredContains creditCard object:
creditCardObjectRequiredRequired fields for this object:
creditCard.firstNameStringRecommendedProvide this value if you have it.
Leave empty if not.
creditCard.lastNameStringRecommendedProvide this value if you have it.
Leave empty if not.
creditCard.numberStringRequired
creditCard.verificationValueStringRecommendedProvide this value if you have it.
Leave empty if not.
creditCard.monthStringRecommendedProvide this value if you have it.
Leave empty if not.
creditCard.yearStringRecommendedProvide this value if you have it.
Leave empty if not.
Additional optional fields
creditCard Object Required Optional fields for this object:
creditCard.company String Optional
creditCard.address1 String Optional
creditCard.address2 String Optional
creditCard.city String Optional
creditCard.state String Optional
creditCard.zip String Optional
creditCard.country String Optional
creditCard.phoneNumber String Optional
creditCard.shippingAddress1 String Optional
creditCard.shippingAddress2 String Optional
creditCard.shippingCity String Optional
creditCard.shippingState String Optional
creditCard.shippingZip String Optional
creditCard.shippingCountry String Optional
creditCard.shippingPhoneNumber String Optional
email String Optional
retained Boolean Optional
allowBlankName Boolean Optional
allowExpiredDate Boolean Optional
eligibleForCardUpdater Boolean Optional

❗️

Real financial data cannot be used in the Sandbox.
Please use our whitelisted test credit cards.

Request

curl --location -g --request POST '
  https://api-sandbox.flex-charge.com/v1/tokenize?mid={Your mid}&environment={Your Tokenization Key}' \
--header 'Content-Type: application/json' \
--data-raw '{
  "payment_method": {
    "credit_card": {
      "first_name": "Joe",
      "last_name": "Jones",
      "number": "5555555555554444",
      "verification_value": "423",
      "month": "3",
      "year": "2029",
    }
  }
}'

The token that returns can be passed without any risks to FlexCharge.


Response

The token is located in the transaction.payment_method.token property.

{
  "transaction": {
    "token": "AXKchwDYMqAmDqDhxCSaEqiHBk0",
    "created_at": "2022-04-14T18:15:18Z",
    "updated_at": "2022-04-14T18:15:18Z",
    "succeeded": true,
    "transaction_type": "AddPaymentMethod",
    "retained": false,
    "state": "succeeded",
    "message_key": "messages.transaction_succeeded",
    "message": "Succeeded!",
    "payment_method": {
      "token": "PTp0nIk2NcqxaTlgsx3Esz2JSAN",
      "created_at": "2022-04-14T18:15:18Z",
      "updated_at": "2022-04-14T18:15:18Z",
      "email": "[email protected]",
      "data": null,
      "storage_state": "cached",
      "test": true,
      "metadata": {
        "key": "string value",
        "another_key": 123,
        "final_key": true
      },
      "callback_url": null,
      "last_four_digits": "4444",
      "first_six_digits": "555555",
      "card_type": "master",
      "first_name": "Joe",
      "last_name": "Jones",
      "month": 3,
      "year": 2029,
      "address1": "33 Lane Road",
      "address2": "Apartment 4",
      "city": "Wanaque",
      "state": "NJ",
      "zip": "31331",
      "country": "US",
      "phone_number": "919.331.3313",
      "company": "Acme Inc.",
      "full_name": "Joe Jones",
      "eligible_for_card_updater": true,
      "shipping_address1": "33 Lane Road",
      "shipping_address2": "Apartment 4",
      "shipping_city": "Wanaque",
      "shipping_state": "NJ",
      "shipping_zip": "31331",
      "shipping_country": "US",
      "shipping_phone_number": "919.331.3313",
      "issuer_identification_number": "55555555",
      "payment_method_type": "credit_card",
      "errors": [

      ],
      "fingerprint": "b5fe350d5135ab64a8f3c1097fadefd9effb",
      "verification_value": "XXX",
      "number": "XXXX-XXXX-XXXX-4444"
    }
  }
}