{"_id":"5bc48b4f9919d4000df5ea7a","project":"57336fd5a6a9c40e00e13a0b","version":{"_id":"5bc48b4f9919d4000df5ea7b","project":"57336fd5a6a9c40e00e13a0b","__v":0,"forked_from":"5b8ec64c7ef0f4000350182a","createdAt":"2018-04-23T15:17:35.680Z","releaseDate":"2018-04-23T15:17:35.680Z","categories":["5bc48b4f9919d4000df5ea33","5bc48b4f9919d4000df5ea34","5bc48b4f9919d4000df5ea35","5bc48b4f9919d4000df5ea36","5bc48b4f9919d4000df5ea37","5bc48b4f9919d4000df5ea38","5bc48b4f9919d4000df5ea39","5bc48b4f9919d4000df5ea3a","5bc48b4f9919d4000df5ea3b","5bc48b4f9919d4000df5ea3c","5bc48b4f9919d4000df5ea3d","5bc48b4f9919d4000df5ea3e","5b34c737e0dca2000311de6a","5bc48b4f9919d4000df5ea3f"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":false,"codename":"3.27.1 Release","version_clean":"8976.0.0-Tools","version":"8976-Tools"},"category":{"_id":"5bc48b4f9919d4000df5ea3f","project":"57336fd5a6a9c40e00e13a0b","version":"5bc48b4f9919d4000df5ea7b","__v":0,"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2018-09-20T16:04:26.117Z","from_sync":false,"order":5,"slug":"embedded-checkout","title":"Embedded Checkout"},"user":"5b155c2c3fbcd30003e76908","__v":0,"parentDoc":null,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2018-09-21T11:59:57.864Z","link_external":false,"link_url":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","examples":{"codes":[]},"method":"post","auth":"required","params":[],"url":"/payment-fields-tokens"},"isReference":false,"order":1,"body":"[block:html]\n{\n  \"html\": \"<script>\\n  // hide body textbox of API Explorer\\n $(document).ready(function() {\\n  $(\\\"textarea[placeholder='Body Content']\\\").hide();  \\n }); \\n</script>\"\n}\n[/block]\nWhen using [Embedded Checkout](doc:embedded-checkout), you will need to obtain a unique Embedded Checkout 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.\n\nFor detailed instructions, see [Implementing Embedded Checkout](https://developers.bluesnap.com/v8976-Tools/docs/embedded-checkout#section-implementing-embedded-checkout).\n[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"Token expiration\",\n  \"body\": \"The Embedded Checkout Token will expire after 60 minutes.\"\n}\n[/block]\n###Request Content\nTo create an Embedded Checkout token, simply send a POST request to:\nSandbox: `https://sandbox.bluesnap.com/services/2/payment-fields-tokens`\nProduction: `https://ws.bluesnap.com/services/2/payment-fields-tokens`\n\n###Response Details\nThe response will provide the token in the location header, as follows: \n`location: BLUESNAPDOMAINPATH/services/2/payment-fields-tokens/HOSTEDFIELDTOKENID`\n\n<hr>\n\n##Examples\n\n###Request Example \n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"curl -v -X POST https://sandbox.bluesnap.com/services/2/payment-fields-tokens \\\\\\n-H 'Content-Type: application/json' \\\\\\n-H 'Accept: application/json' \\\\ \\n-H 'Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=' \\\\\\n-d '\",\n      \"language\": \"curl\",\n      \"name\": \"Create Embedded Checkout Token Request\"\n    }\n  ]\n}\n[/block]\n###Response Example\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"HTTP/ 1.1 201 Created\\nLocation: https://sandbox.bluesnap.com/services/2/payment-fields-tokens/12345abcde*********\",\n      \"language\": \"http\"\n    }\n  ]\n}\n[/block]\n##API Explorer\nTo generate a test Embedded Checkout token, which you can use in test requests within this documentation, use the API Explorer below. Click **Try It!** to run the call.","excerpt":"","slug":"create-embedded-checkout-token","type":"endpoint","title":"Create Embedded Checkout Token"}

postCreate Embedded Checkout Token


Definition

{{ api_url }}{{ page_api_url }}

Documentation

When using Embedded Checkout, you will need to obtain a unique Embedded Checkout 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 Embedded Checkout.

Token expiration

The Embedded Checkout Token will expire after 60 minutes.

Request Content

To create an Embedded Checkout 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*********

API Explorer

To generate a test Embedded Checkout token, which you can use in test requests within this documentation, use the API Explorer below. Click Try It! to run the call.


User Information

Try It Out


post
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}