The quickest way to build conversion-optimized payment modal, hosted on PaySwifter.

Checkout creates a secure, PaySwifter-hosted payment page that lets you collect payments quickly. It works across devices and can help increase your conversion. Checkout makes it easy to build a first-class payments experience:

  • Designed to remove friction—Real-time customer authentication with built-in error messaging
  • Mobile-ready— Fully responsive design with Apple and iOS devices
  • Customization and branding—Customizable logo and background-color
  • Fraud and compliance—Simplified NACHA compliance, and CAPTCHAs to mitigate attacks
  • Additional features—Add tips, 1-click checkout experience, send email receipts, and more

Steps

  1. Create a session whenever the customer intends to pay online and get a sessionID.

Request Parameter

Data Type

Field

amount

integer

required

type

string

required

consumer_info

object

required

curl --request POST \
     --url https://sparc-pay-api.prod.swifterhq.com/api/v1.0/sessions \
     --header 'Accept: application/json' \
     --header 'Content-Type: application/json'
     --data "{\"amount\": \"1000\",\"type\":\"consumer_checkout\",\"consumer_info\":{\"first_name\": \"First\",\"last_name\": \"Last\",\"email\": \"[email protected]\",\"phone\": \"+19999999999\",\"drivers_license\": \"XXXXXXXX\"}}"
const sdk = require('api')('@payswifter/v1.0#1f7erlgkue3ynzm');

const request = {
    "amount": 1000,
    "type": "consumer_checkout",
    "consumer_info": {
        "first_name": "User",
        "last_name": "Name",
        "phone": "+19999999999",
        "email": "[email protected]",
        "drivers_license": "XXXXXXX"
    }
};

sdk['create_session_sessions_post']()
  .then(res => console.log(res))
  .catch(err => console.error(err));
require 'uri'
require 'net/http'
require 'openssl'

url = URI("https://sparc-pay-api.prod.swifterhq.com/api/v1.0/sessions")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Accept"] = 'application/json'
request["Content-Type"] = 'application/json'

response = http.request(request)
puts response.read_body
import requests

url = "https://sparc-pay-api.prod.swifterhq.com/api/v1.0/sessions"

headers = {
    "Accept": "application/json",
    "Content-Type": "application/json"
}

response = requests.request("POST", url, headers=headers)

print(response.text)
{
  "id": "string",
  "create_date": "2021-10-11T10:11:28.215Z",
  "status": "started",
  "organization_id": "string",
  "type": "consumer_checkout",
  "total_amount": 0,
  "is_valid_consumer": true,
  "is_valid_bank_account_selected": true,
  "is_sufficient_funds": true,
  "consent_text": "string",
  "fees": 0,
  "track_number": "string"
}
  1. Initialize the PaySwifter.js on the checkout page whenever the customer intends to pay with ACH.
<script src="https://js.payswifter.com/v1.js"></script>
<script type="text/javascript">
const sp = new SwifterPay();
const init = function() {
        sp.startSession({
          "sessionID": "<sessionID>"
        })
</script>
  1. Use OnComplete and OnExit functions in PaySwifter.js to trigger the next set of actions.
<script src="https://js.payswifter.com/v1.js"></script>
<script type="text/javascript">
const sp = new SwifterPay();
const init = function() {
        sp.startSession({
          "sessionID": "SESSION_ID_FROM_SWIFTERPAYAPI", 
          "onComplete": (response) => {
            // Called on successful session completion
          },
            "onExit": (response) => {
            // Called on a failed session
          }
        })
};
</script>

Sample Success Response

{
  createdDate: '2021-12-19T03:33:28.574215+00:00', 
  fees: 150, 
  referenceId: 'hfyx47', 
  tip: null, 
  orderAmount: 100, 
  totalAmount: 250
}

Sample error response

List of all the error codes can be found here.

{
  type: 'session_insufficient_balance',
  code: null
}
  1. On successful session completion, you should create an order and get an OrderID.

Note - You will need the storeID for this step. You can find the StoreID from here.

curl --request POST \
     --url https://sparc-pay-api.prod.swifterhq.com/api/v1.0/orders \
     --header 'Accept: application/json' \
     --header 'Content-Type: application/json'
     --data "{\"session_id\":\"{sessionId}\",\"store_identifier\":\"{cart.storeName}\",\"ticket\":{\"ticket_identifier\":\"{treezTicketId}\",\"type\":\"treez\"}}"
const sdk = require('api')('@payswifter/v1.0#1f7erlgkue3ynzm');

const request = {
    "sessionID":"SESSION_ID_FROM_SPARCPAYAPI",
  "storeIdentifier":"STORE_ID",
  "ticket":{
    "type":"TICKET_TYPE",
    "identifier":"TICKET_ID"
  }
};

sdk['create_order_orders_post']()
  .then(res => console.log(res))
  .catch(err => console.error(err));
require 'uri'
require 'net/http'
require 'openssl'

url = URI("https://sparc-pay-api.prod.swifterhq.com/api/v1.0/orders")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Accept"] = 'application/json'
request["Content-Type"] = 'application/json'

response = http.request(request)
puts response.read_body
import requests

url = "https://sparc-pay-api.prod.swifterhq.com/api/v1.0/orders"

headers = {
    "Accept": "application/json",
    "Content-Type": "application/json"
}

response = requests.request("POST", url, headers=headers)

print(response.text)
{
  "store": {
    "id": "string",
    "create_date": "2021-10-11T10:32:05.112Z",
    "name": "string",
    "organization_id": "string",
    "store_identifier": "string",
    "brand_name": "string",
    "contact_email": "[email protected]",
    "logo_url": "string",
    "privacy_policy_url": "string",
    "tos_url": "string",
    "sub_domain": "string",
    "domain": "string"
  },
  "order": {
    "id": "string",
    "create_date": "2021-10-11T10:32:05.112Z",
    "store_id": "string",
    "charge_id": "string",
    "delivered_date": "2021-10-11T10:32:05.112Z",
    "total_amount": 0,
    "status": "submitted",
    "track_number": "string",
    "updated_at": "2021-10-11T10:32:05.112Z"
  },
  "ticket": {
    "id": "string",
    "create_date": "2021-10-11T10:32:05.112Z",
    "external_id": "string",
    "type": "treez",
    "order_id": "string",
    "status": "pending",
    "store_identifier": "string",
    "external_customer_id": "string",
    "external_short_identifier": "string",
    "client_id": "string",
    "logistic_provider_id": "string"
  },
  "session": {
    "id": "string",
    "create_date": "2021-10-11T10:32:05.112Z",
    "status": "started",
    "organization_id": "string",
    "type": "consumer_checkout",
    "total_amount": 0,
    "is_valid_consumer": true,
    "is_valid_bank_account_selected": true,
    "is_sufficient_funds": true,
    "consent_text": "string",
    "fees": 0,
    "track_number": "string"
  },
  "line_items": [
    {
      "description": "total",
      "amount": 0
    }
  ]
}
  1. Based on your fulfillment flow, charge the order whenever you want to initiate a charge for that order.
curl --request POST \
     --url https://sparc-pay-api.prod.swifterhq.com/api/v1.0/orders/order_id/charge \
     --header 'Accept: application/json'
     --data "{\"order_id\":\"ORDER_ID\"}"
const sdk = require('api')('@payswifter/v1.0#1f7erlgkue3ynzm');

const request = {order_id: 'ORDER_ID'};

sdk['charge_order_by_id_orders__order_id__charge_post'](request)
  .then(res => console.log(res))
  .catch(err => console.error(err));
require 'uri'
require 'net/http'
require 'openssl'

url = URI("https://sparc-pay-api.prod.swifterhq.com/api/v1.0/orders/order_id/charge")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Accept"] = 'application/json'

response = http.request(request)
puts response.read_body
import requests

url = "https://sparc-pay-api.prod.swifterhq.com/api/v1.0/orders/order_id/charge"

headers = {"Accept": "application/json"}

response = requests.request("POST", url, headers=headers)

print(response.text)
{
  "order": {
    "id": "string",
    "create_date": "2021-10-11T10:34:02.478Z",
    "store_id": "string",
    "charge_id": "string",
    "delivered_date": "2021-10-11T10:34:02.478Z",
    "total_amount": 0,
    "status": "submitted",
    "track_number": "string",
    "updated_at": "2021-10-11T10:34:02.478Z"
  },
  "transaction": {
    "id": "string",
    "create_date": "2021-10-11T10:34:02.478Z",
    "available_on_date": "2021-10-11T10:34:02.478Z",
    "status": "pending",
    "amount": 0,
    "type": "payment",
    "sub_type": "default",
    "organization_id": "string",
    "business_fi_account_id": "string",
    "settlement_window_id": "string",
    "track_number": "string"
  }
}