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.


Customer

Type:  
Abstract:  no
Status:  Active
Java Class:  Customer
Represents information about the customer.
id
References: Customer Account.Id
XML Representation: attribute
Attributes:
Default Value
Identifier of the object used for references; auto-incremented integer value.
code
References: Customer.Reference Code
XML Representation: attribute
Attributes: CreateOnly
Default Value
Pattern: CODE
Secondary identifier, which can be used to cross-reference records between UniPay and integrated systems.

See Reference field type for additional information.
accountId
References: Customer.Merchant Account Code
XML Representation: attribute
Attributes: Required, CreateOnly
Default Value
Code of Merchant Account to which instance of this object is attributed to. Depending on the context, Merchant Account Code field may contain either Merchant Code or Merchant Account Code.
The field is primarily used for data partitioning and data management, to make it easy to determine the ownership of a record within the database.


Identifier of the account within the gateway.
createDate
References: Customer.Create Date
XML Representation: attribute
Attributes:
Default Value
Date when the record was created.

In API request, the date must be submitted in yyyy-MM-dd format.
In API response, the date is returned in yyyy-MM-dd HH:mm:ss format.
firstName
References: Customer.First Name
XML Representation: attribute
Attributes: Required
Default Value
Pattern: NAME
First name of the customer. This field is set for both person and organization types of customers. For organizations, this field is used for the first name of the company's contact person.
lastName
References: Customer.Last Name
XML Representation: attribute
Attributes: Required
Default Value
Pattern: NAME
Last name of the customer. This field is set for both person and organization types of customers. For organizations, this field is used for the last name of the company's contact person.
organizationName
References: Customer.Organization Name
XML Representation: attribute
Attributes:
Default Value
Pattern: NAME_BUSINESS
Name of the organization associated with a customer.
email
Type: String(100)
XML Representation: attribute
Attributes:
Default Value
Pattern: EMAIL
Email address of the customer.
phone
Type: String(15)
XML Representation: attribute
Attributes: Required
Default Value
Pattern: NUMERIC
Phone number of the customer.
isActive
References: Customer Account.Is Active
XML Representation: attribute
Attributes: Default: true
Default Value true
Indicates whether the record is active in the system.

Indicates whether a record is active within the system.
balance
Type: Integer(11)
XML Representation: attribute
Attributes:
Default Value
Balance of the customer.
street1
References: Address.Street 1
XML Representation: attribute
Attributes:
Default Value
Pattern: STREET
Street address of the customer.
street2
References: Address.Street 2
XML Representation: attribute
Attributes:
Default Value
Pattern: STREET
Street address of the customer.
city
References: Address.City
XML Representation: attribute
Attributes:
Default Value
Pattern: ALPHANUMERIC_EXTENDED
City of the customer.
countryCode
References: Address.Country Code
XML Representation: attribute
Attributes: Default: US
Default Value US
Pattern: ALPHA
Country code of the customer's address.
state
References: Address.State
XML Representation: attribute
Attributes:
Default Value
State of the customer.
zipCode
References: Address.ZIP Code
XML Representation: attribute
Attributes:
Default Value
ZIP or postal code of the customer.
holderName
Type: String
XML Representation: attribute
Attributes:
Default Value
address
References: Address.Address
XML Representation: attribute
Attributes: Calculated
Default Value
Address associated with a payment card or bank account holder. The value is a concatenation of the street1, street2, city, state, zipCode, countryCode field values separated by commas (,).


Address associated with a payment card or bank account holder. The value is a concatenation of the street1, street2, city, state, zipCode, countryCode field values separated by commas (,).

XML Sample:

<customer
    id="" 
    code="" 
    accountId="" 
    createDate="" 
    firstName="John Smith" 
    lastName="John Smith" 
    organizationName="UnitedThinkers" 
    email="" 
    phone="" 
    isActive="" 
    balance="" 
    street1="" 
    street2="" 
    city="" 
    countryCode="" 
    state="" 
    zipCode="" 
    holderName="" 
    address="" />

"<customer id=\"\" code=\"\" accountId=\"\" createDate=\"\" firstName=\"John Smith\" lastName=\"John Smith\" organizationName=\"UnitedThinkers\" email=\"\" phone=\"\" isActive=\"\" balance=\"\" street1=\"\" street2=\"\" city=\"\" countryCode=\"\" state=\"\" zipCode=\"\" holderName=\"\" address=\"\" />"

JSON Sample:

{
  "id": "",
  "code": "",
  "accountId": "",
  "createDate": "",
  "firstName": "John Smith",
  "lastName": "John Smith",
  "organizationName": "UnitedThinkers",
  "email": "",
  "phone": "",
  "isActive": "",
  "balance": "",
  "street1": "",
  "street2": "",
  "city": "",
  "countryCode": "",
  "state": "",
  "zipCode": "",
  "holderName": "",
  "address": ""
}

XURL Sample:

?id=&code=&accountId=&createDate=&firstName=John+Smith&lastName=John+Smith&organizationName=UnitedThinkers&email=&phone=&isActive=&balance=&street1=&street2=&city=&countryCode=&state=&zipCode=&holderName=&address=&
id=
code=
accountId=
createDate=
firstName=John Smith
lastName=John Smith
organizationName=UnitedThinkers
email=
phone=
isActive=
balance=
street1=
street2=
city=
countryCode=
state=
zipCode=
holderName=
address=