Create Hosted Payment Fields Token

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.


Token expiration

The Hosted Payment Fields Token will expire after 60 minutes.

Request Content

To create a Hosted Payment Fields token, simply send a POST request to:

Response Details

The response will provide the token in the location header, as follows:
location: BLUESNAPDOMAINPATH/services/2/payment-fields-tokens/HOSTEDFIELDTOKENID


Request Example

curl -v -X POST \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \ 
-H 'Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=' \
-d '

Response Example



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
HTTP/2 201 Created