When using Hosted Payment Fields, you will need to obtain a unique Hosted Payment Fields token for each session, and then use that in your checkout form. BlueSnap will save the shopper's payment information and associate it with the token, and you can include the token in your API requests in order to process card transactions or create or update vaulted shoppers.
For detailed instructions, see Implementing Hosted Payment Fields in your checkout form.
The Hosted Payment Fields Token will expire after 60 minutes.
To create a Hosted Payment Fields token, simply send a POST request to:
The response will provide the token in the location header, as follows:
curl -v -X POST https://sandbox.bluesnap.com/services/2/payment-fields-tokens \ -H 'Content-Type: application/json' \ -H 'Accept: application/json' \ -H 'Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=' \ -d '
The code to retrieve the location header parameter needs to be case-insensitive to account for HTTP/1 and HTTP/2 protocols. This is because HTTP/2 protocol requires that header parameter names are lowercase.
HTTP/ 1.1 201 Created Location: https://sandbox.bluesnap.com/services/2/payment-fields-tokens/12345abcde*********
HTTP/2 201 Created location: https://sandbox.bluesnap.com/services/2/payment-fields-tokens/12345abcde*********