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:
Default Value
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
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
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
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
Name of the organization associated with a customer.
email
Type: String(100)
XML Representation: attribute
Attributes:
Default Value
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 Value
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
Type: String(128)
XML Representation: attribute
Attributes:
Default Value
Street address of the customer.
street2
Type: String(128)
XML Representation: attribute
Attributes:
Default Value
Street address of the customer.
city
Type: String(50)
XML Representation: attribute
Attributes:
Default Value
City of the customer.
countryCode
Type: String(2)
XML Representation: attribute
Attributes:
Default Value
Country code of the customer's address.
state
Type: String(3)
XML Representation: attribute
Attributes:
Default Value
State of the customer.
zipCode
Type: String(10)
XML Representation: attribute
Attributes:
Default Value
ZIP or postal code of the customer.
holderName
References: Customer.Holder Name
XML Representation: attribute
Attributes: Calculated
Default Value
Name of a payment card or bank account holder. The value is a concatenation of the firstName and lastName field values separated by a space.
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 (,).

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": ""
}

Query String 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=