Saving a card token with the API

Background
Before starting this tutorial, make sure you understand the following topics from the Quick start section:
  1. Configure your Account

    Contact Integrations Support to ensure your merchant ID and account have access to the proper API endpoint.
    (You may be asked to provide additional information such as Gateway, TokenEx, or Kount credentials.)

  2. Request a One-time-use Token

    Send a POST request to the Create one-time-use token endpoint.
    (Do not include any card information or other body parameters—you will do that in step 3.)

    Copy or store the token from Nexio's response.
    It will be used in the next step.

    curl -X POST https://api.nexiopaysandbox.com/pay/v3/token \
      -H 'Content-Type: application/json' \
      -H 'Accept: application/json' \
      -H 'Authorization: Basic [Base64_encoded_login]'
      -d '{}'
    

    {
      "expiration": "2018-09-18T15:43:05.664Z",
      "fraudUrl": "https://api.nexiopaysandbox.com/pay/v3/fingerprint?token=01080f80-76b8-4363-845d-67e8623bf170",
      "token": "830d36f6-a5e3-4455-9600-3a55b63e2fc2"
    }
    

  3. Post Card Information to Nexio

    Send a POST request to the Save card token endpoint.
    Include the token from step 2 and the card information in the body of your request.

    curl -X POST https://api.nexiopaysandbox.com/pay/v3/saveCard \
      -H 'Content-Type: application/json' \
      -H 'Accept: application/json' \
      -H 'Authorization: Basic [Base64_encoded_login]'
      -d '{
      "card": {
        "cardHolderName": "John H Doe",
        "encryptedNumber": "cu3yRktaYFK2LUC6DpNK289tYDsGRCi7cO+GeG0hkeYFvT7Y8/oY5r53obMz6Q/BZ38gk2u2Ufwy8ojBcX2sfNjG5jplGTXA4NNlSIUjMFfiHe1sff1JFpThoiW/IIlifGlbWu+S1/9pqWPTzJ2+DcjwohbHzsDahhYewFhXgC8qsK0ypi/Shlp+CwRITyIvbVXESD0xz3YOTRHeZLlChvVqN8z4ZzN8nm0MXkmT1wcpYI73bH4KdnPwNU3s7XxvP/ernQP73SHHAOKSLlz4F6AEHFjJiCoXzeLF7LwEjRdxDJ0sKVXbRk3i9BGh+8Nle2VYgjpUWtk2763QkvZiQQ==",
        "expirationMonth": "12",
        "expirationYear": "20"
      },
      "token": "eb50a022-d6de-4244-a1e6-dcb8522b2d19"
    }'