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.
`}
###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.
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
</div>
</div>
<!-- Checkout form -->
Enter your card details
Name on Card
Card Number
<span class="helper-text" id="ccn-help"></span>
</div>
<!--Hosted Field for CC EXP-->
<div class="form-group col-xs-7">
<label for="exp-date">Exp. Date</label>
<div class="form-control" id="exp-date" data-bluesnap="exp"></div>
<span class="helper-text" id="exp-help"></span>
</div>
<!--Hosted Field for CC CVV-->
<div class="form-group col-xs-5">
<label for="cvv">CVV</label>
<div class="form-control" id="cvv" data-bluesnap="cvv"></div>
<span class="helper-text" id="cvv-help"></span>
</div>
<button class="btn btn-success btn-lg center-block" type="submit" id="submit-button" style="margin-bottom:1em;">Pay Now</button>
</form>
`}
{`
`}
{`
`}
###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.
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.
{<span id="success-message">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!</span>}
👍
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.