Billing APIs

Introduction
Billing API is a RESTful API that allows setting up customers, collecting payments and maintaining balances for these customers, as well as creating recurring billing subscriptions.

Billing API documentation includes the following sections:

Objects - lists all recurring billing objects. The purpose of this section is to describe all object fields, their format and usage, provide the links to the corresponding database tables.

Type Enumerations – lists possible values that can be used in the respective fields within Billing API requests and responses. The purpose of this section is to provide an explanation of all enumerations used for API calls.

Actions - lists all actions that can be performed with key recurring billing objects. The purpose of this section is to describe the methods and format of API requests and the format of responses.

Integration Notes – lists integration notes associated with the Billing API objects and actions. The purpose of this section is to provide explicit information about the peculiarities of specific actions and object fields.

Code samples - provides examples of recurring billing use cases (creating billing plans, subscriptions, freeing or canceling subscriptions, reversing transactions, etc) and their implementation in JSON, XML, XURL formats. The purpose of this section is to provide examples that can be used for testing of the integration with the gateway.

To learn how to work with the Billing API, we recommend reviewing the integration notes first. Key recurring billing module terms are available here.
For more detailed information about the recurring billing configurations and management, check the Recurring Billing Guide.


Billing APIs Code Samples

Add a New Customer with a perpetual term Subscription, billed weekly, using ACH

A customer is signing up for a service for $19.99 collected monthly, $19.99 due at signing. The subscription is perpetual and paid via ACH.


View Implementation:

1) Adding a new customer.
Method: PUT
Path: [version]/customers/~create
Value Name
code customer1
accountId 2001
firstName John
lastName Smith
organizationName Organization LLC
email jsmith@mail.com
phone 2129856472
isActive true
street1 12 Main St
street2 5th Ave
city New York
countryCode US
state NY
zipCode 31904
{
"code":"customer1",
"accountId":"2001",
"firstName":"John",
"lastName":"Smith",
"organizationName":"Organization LLC",
"email":"jsmith@mail.com",
"phone":"2129856472",
"isActive":"true",
"street1":"12 Main St",
"street2":"5th Ave",
"city":"New York",
"countryCode":"US",
"state":"NY",
"zipCode":"31904"
}
2) Adding the customer's bank account details.
Method: PUT
Path: [version]/customers/[customer-id]/payment-options/~create
Value Name
code account1
type BC
accountNumber 4099999992
accountAccessory 021000021
isActive true
csc 111
street1 233 12th Street
street2 5th Ave
city New Yor
countryCode US
state NY
zipCode 11111
{
"code":"account1",
"type":"BC",
"accountNumber":"4099999992",
"accountAccessory":"021000021",
"isActive":"true",
"csc":"111",
"street1":"233 12th Street",
"street2":"5th Ave",
"city":"New Yor",
"countryCode":"US",
"state":"NY",
"zipCode":"11111"
}
3) Adding a perpetual Subscription based on the previously created pricing plan (Standard monthly plan for $19.99).
Note: the billing cycle starts by default on the next day after the subscription is created. If you want the billing cycle to start from a specific date in the future, it should be defined in the firstBillingDate parameter in the request.
Method: PUT
Path: [version]/customers/[customer-id]/subscriptions/~create
Value Name
code subscription1
amount 1999
firstBillingDate 2020-01-01
note Perpetual subscription
paymentOptionId account1
planId *standard_monthly
type P
{
"code":"subscription1",
"amount":"1999",
"firstBillingDate":"2020-01-01",
"note":"Perpetual subscription",
"paymentOptionId":"account1",
"planId":"*standard_monthly",
"type":"P"
}
4) Creating an invoice for downpayment.
Method: PUT
Path: [version]/customers/[customer-id]/transactions/~create
Value Name
code invoice1
type RI
amount 1999
{
"code":"invoice1",
"type":"RI",
"amount":"1999"
}
5) Collecting downpayment.
Method: POST
Path: [version]/customers/[customer-id]/transactions/~process
Value Name
holderName John Smith
accountNumber 4111111111111111
accountAccessory 0422
csc 999
street 233 12th Street
city New York
state NY
zipCode 31909
email test@yahoo.com
type AP
accountType VC
amount 1999
note payment for downpayment
{
"holderName":"John Smith",
"accountNumber":"4111111111111111",
"accountAccessory":"0422",
"csc":"999",
"street":"233 12th Street",
"city":"New York",
"state":"NY",
"zipCode":"31909",
"email":"test@yahoo.com",
"type":"AP",
"accountType":"VC",
"amount":"1999",
"note":"payment for downpayment"
}
1) Adding a new customer.
Method: PUT
Path: [version]/customers/~create
Value Name
code customer1
accountId 2001
firstName John
lastName Smith
organizationName Organization LLC
email jsmith@mail.com
phone 2129856472
isActive true
street1 12 Main St
street2 5th Ave
city New York
countryCode US
state NY
zipCode 31904
<customer
    code = "customer1" 
    accountId = "2001" 
    firstName = "John" 
    lastName = "Smith" 
    organizationName = "Organization LLC" 
    email = "jsmith@mail.com" 
    phone = "2129856472" 
    isActive = "true" 
    street1 = "12 Main St" 
    street2 = "5th Ave" 
    city = "New York" 
    countryCode = "US" 
    state = "NY" 
    zipCode = "31904" 
/>
2) Adding the customer's bank account details.
Method: PUT
Path: [version]/customers/[customer-id]/payment-options/~create
Value Name
code account1
type BC
accountNumber 4099999992
accountAccessory 021000021
isActive true
csc 111
street1 233 12th Street
street2 5th Ave
city New Yor
countryCode US
state NY
zipCode 11111
<payment-option
    code = "account1" 
    type = "BC" 
    accountNumber = "4099999992" 
    accountAccessory = "021000021" 
    isActive = "true" 
    csc = "111" 
    street1 = "233 12th Street" 
    street2 = "5th Ave" 
    city = "New Yor" 
    countryCode = "US" 
    state = "NY" 
    zipCode = "11111" 
/>
3) Adding a perpetual Subscription based on the previously created pricing plan (Standard monthly plan for $19.99).
Note: the billing cycle starts by default on the next day after the subscription is created. If you want the billing cycle to start from a specific date in the future, it should be defined in the firstBillingDate parameter in the request.
Method: PUT
Path: [version]/customers/[customer-id]/subscriptions/~create
Value Name
code subscription1
amount 1999
firstBillingDate 2020-01-01
note Perpetual subscription
paymentOptionId account1
planId *standard_monthly
type P
<subscription
    code = "subscription1" 
    amount = "1999" 
    firstBillingDate = "2020-01-01" 
    note = "Perpetual subscription" 
    paymentOptionId = "account1" 
    planId = "*standard_monthly" 
    type = "P" 
/>
4) Creating an invoice for downpayment.
Method: PUT
Path: [version]/customers/[customer-id]/transactions/~create
Value Name
code invoice1
type RI
amount 1999
<transaction
    code = "invoice1" 
    type = "RI" 
    amount = "1999" 
/>
5) Collecting downpayment.
Method: POST
Path: [version]/customers/[customer-id]/transactions/~process
Value Name
holderName John Smith
accountNumber 4111111111111111
accountAccessory 0422
csc 999
street 233 12th Street
city New York
state NY
zipCode 31909
email test@yahoo.com
type AP
accountType VC
amount 1999
note payment for downpayment
<transaction
    holderName = "John Smith" 
    accountNumber = "4111111111111111" 
    accountAccessory = "0422" 
    csc = "999" 
    street = "233 12th Street" 
    city = "New York" 
    state = "NY" 
    zipCode = "31909" 
    email = "test@yahoo.com" 
    type = "AP" 
    accountType = "VC" 
    amount = "1999" 
    note = "payment for downpayment" 
/>
1) Adding a new customer.
Method: PUT
Path: [version]/customers/~create
Parameters: code=customer1&accountId=2001&firstName=John&lastName=Smith&organizationName=Organization+LLC&email=jsmith%40mail.com&phone=2129856472&isActive=true&street1=12+Main+St&street2=5th+Ave&city=New+York&countryCode=US&state=NY&zipCode=31904
Value Name
code customer1
accountId 2001
firstName John
lastName Smith
organizationName Organization LLC
email jsmith@mail.com
phone 2129856472
isActive true
street1 12 Main St
street2 5th Ave
city New York
countryCode US
state NY
zipCode 31904
2) Adding the customer's bank account details.
Method: PUT
Path: [version]/customers/[customer-id]/payment-options/~create
Parameters: code=account1&type=BC&accountNumber=4099999992&accountAccessory=021000021&isActive=true&csc=111&street1=233+12th+Street&street2=5th+Ave&city=New+Yor&countryCode=US&state=NY&zipCode=11111
Value Name
code account1
type BC
accountNumber 4099999992
accountAccessory 021000021
isActive true
csc 111
street1 233 12th Street
street2 5th Ave
city New Yor
countryCode US
state NY
zipCode 11111
3) Adding a perpetual Subscription based on the previously created pricing plan (Standard monthly plan for $19.99).
Note: the billing cycle starts by default on the next day after the subscription is created. If you want the billing cycle to start from a specific date in the future, it should be defined in the firstBillingDate parameter in the request.
Method: PUT
Path: [version]/customers/[customer-id]/subscriptions/~create
Parameters: code=subscription1&amount=1999&firstBillingDate=2020-01-01&note=Perpetual+subscription&paymentOptionId=account1&planId=%2Astandard_monthly&type=P
Value Name
code subscription1
amount 1999
firstBillingDate 2020-01-01
note Perpetual subscription
paymentOptionId account1
planId *standard_monthly
type P
4) Creating an invoice for downpayment.
Method: PUT
Path: [version]/customers/[customer-id]/transactions/~create
Parameters: code=invoice1&type=RI&amount=1999
Value Name
code invoice1
type RI
amount 1999
5) Collecting downpayment.
Method: POST
Path: [version]/customers/[customer-id]/transactions/~process
Parameters: holderName=John+Smith&accountNumber=4111111111111111&accountAccessory=0422&csc=999&street=233+12th+Street&city=New+York&state=NY&zipCode=31909&email=test%40yahoo.com&type=AP&accountType=VC&amount=1999&note=payment+for+downpayment
Value Name
holderName John Smith
accountNumber 4111111111111111
accountAccessory 0422
csc 999
street 233 12th Street
city New York
state NY
zipCode 31909
email test@yahoo.com
type AP
accountType VC
amount 1999
note payment for downpayment