Welcome to the BlueSnap Developer Hub. Our Payment API is RESTful and uses standard HTTP features. Design your own checkout form and use our API to take credit and debit cards, digital wallets, ACH, SEPA Direct Debit, PayPal, and more.

Start coding

    Step 1: Build a checkout form

  Start now

    Step 2: Make a payment

  Start now

<span id="try-it-now-1"
###Try it now
Try our Payment API here! Create a token, charge a card, and vault the shopper by following these steps:


###1. Token The first step is to create a Hosted Payment Fields token by sending a server-to-server POST request to BlueSnap. A successful response provides the token in the location header, as follows: `location: BLUESNAPDOMAINPATH/services/2/payment-fields-tokens/HOSTEDFIELDTOKENID`

The following code shows a sample request and response.

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 '
HTTP/ 1.1 201 Created
location: https://sandbox.bluesnap.com/services/2/payment-fields-tokens/f977b920a0c6a55b2156635f368ed94cd37c26b62ac2b1e521e17ace6495f874_
Try it!

Click the button below to go to our API Explorer. Click the Try it! button on the page, and copy the token from the response’s location header. Return here and paste your token.


###2. Card BlueSnap captures the shopper's sensitive card data via our Hosted Payment Fields, and binds it to the token. Your PCI compliance is reduced to SAQ-A because sensitive data never hits your sever.

Here's an example of a Hosted Payment Fields integration configured with your token from Step 1.
To see the code, check out our CodePen.

Try it!
Enter this test card:

Card Number: 4263982640269299

Exp. Date: 02/23

CVV: 837

Click the Pay Now button

Enter your card details


###3. Charge & Vault To charge the card, you'll send the request including the token within `pfToken`. BlueSnap automatically vaults the shopper's information associated with the token, and return a `vaultedShopperId`. The value is a unique ID used to identify the shopper within BlueSnap.

The following code shows a sample Auth Capture request and response.

curl -v -X POST https://sandbox.bluesnap.com/services/2/transactions \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \ 
-H 'Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=' \
-d '
{
  "pfToken": "812f6ee706e463d3276e3abeb21fa94072e40695ed423ddac244409b3b652eff_",
  "amount": 11,
  "currency": "USD",
  "cardTransactionType": "AUTH_CAPTURE",
  "cardHolderInfo": {
      "firstName": "Jane",
      "lastName": "Shopper", 
      "zip": "02451"
  }
}'
{
  "cardTransactionType": "AUTH_CAPTURE",
  "transactionId": "1014271871",
  "softDescriptor": "Test Descriptor",
  "amount": 11,
  "currency": "USD",
  "cardHolderInfo": {
      "firstName": "Jane",
      "lastName": "Shopper",
      "zip": "02451"
  },
  "vaultedShopperId": 21828023,
  "creditCard": {
      "cardLastFourDigits": "9299",
      "cardType": "VISA",
      "cardSubType": "CREDIT",
      "cardCategory": "GOLD"
  },
  "processingInfo": {
      "processingStatus": "success",
      "cvvResponseCode": "MA",
      "avsResponseCodeZip": "U",
      "avsResponseCodeAddress": "U",
      "avsResponseCodeName": "U"
  }
}
Try it!
{
  "pfToken": "",
  "amount": 11,
  "currency": "USD",
  "cardTransactionType": "AUTH_CAPTURE",
  "cardHolderInfo": {
      "firstName": "Jane",
      "lastName": "Shopper", 
      "zip": "02451"
  }
}
Copy and run the above JSON object in the API Explorer (This'll only work if you entered a valid token in Step 1). Copy the value of vaultedShopperId from the response, and return here to paste it.


###4. Success!
Congrats! The shopper has successfully been charged and their payment details are safely stored. For all future transactions, use the vaulted shopper ID in the request to charge their card again. There is no need for the shopper to re-enter their information. Checkout is a breeze!

👍

Visit our API Reference

For a complete list of API endpoints, request and response parameters, and code samples, visit our Payment API Reference.


###Tip: Try out the API right in the docs In the API reference docs, look for the **Try it here!** sections. You can try out different parameters and test credit card numbers to see exactly how your test scenario would work.

Looking for a hosted solution?

You can use our BuyNow Hosted Checkout pages for a simple way to offer your global customers a seamless buying experience on any device. No development needed. Learn more.