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: Sandbox: https://sandbox.bluesnap.com/services/2/payment-fields-tokens Production: https://ws.bluesnap.com/services/2/payment-fields-tokens

Response Details

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


Examples

Request Example

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 '

Response Example

HTTP/ 1.1 201 Created
Location: https://sandbox.bluesnap.com/services/2/payment-fields-tokens/12345abcde*********