API Flow
  • 18 Mar 2024
  • 1 Minute to read
  • Dark
    Light

API Flow

  • Dark
    Light

Article summary

Blackthorn no longer supports Payments APIs. 
The documentation provided is a self-help resource for legacy implementations only. 

The typical API order of record creation is as follows:

REST API

  1. The first step in a typical custom payments flow is to get your customer's card data. You'll want to tokenize the card number for PCI compliance reasons. From your frontend use Stripe.js to do this. Here are some samples of what you can use.
  2. Stripe.js will return a token. After you receive this token, you'll want to pass the token to your Salesforce Sites endpoint with the Blackthorn | Payments Apex class behind it. From the link in #1 above, the code reference is:
var endpoint = 'https://p360-dev8-developer-edition.na40.force.com/endpoint/services/apexrest/v1';

...replace the p360-dev8-developer-edition with your domain.

  1. You'll likely then want to create your Transaction so you can charge the Payment Method. Follow the examples towards the bottom of this page to do so. Reference example #1 for additional context and/or an altered process on how to create a Payment Method + a Payment Gateway Customer before you'd create your Transaction.

Apex API
Currently, we support sending raw card data to Stripe, but we are deprecating this functionality soon. At the moment, passing a token to the Apex API is not supported, but will be supported soon (Q2 '18). For the time being, follow the 'Basic example' referenced here, but if you want to 'future proof' your integration, we'd suggest using our REST API for now.