Recurring Billing SDK
The 360-One Recurring Billing Solution (RBS) is designed to assist clients who process installment or recurring billing. Using the Recurring Billing SDK is the fastest way to integrate the service.
Contents
Notes
The Java SDK communicates with the API by using a HTTP POST with the HttpURLConnection class. It does not have any dependencies outside standard Java classes. The minimum version of Java required is 1.5.
The C# SDK communicates with the API by using a HTTP POST with the HttpWebRequest class. The library was written using Microsoft .NET framework version 4.5, unless otherwise stated in the download above.
Note Be sure to use the LIVE endpoint in a production site – recurring records sent to TEST will be simulated.
Overview
The Recurring Billing API has two environments available for use:
- GatewayUrl.Test The test server uses the test database. It may be used during development, if the certification manager issues test credentials.
- GatewayUrl.Live The live server should be used to pull reports from live merchant accounts.
Create record Example
Below, we’ll create a record set to bill monthly, on a credit card, starting on 05/13, running each month on that day indefinitely (payment count is set to 0).
Request
- RbsSettings settings = new RbsSettings()
.credentials(“testuser”, “testpass”, “9410000xxxxx0000000x”)
.hostUrl(RbsSettings.URL_LIVE)
.verbose(true);Rbs rbs = new Rbs(settings);try {
RbsRequest cRequest = new RbsRequest(RequestType.CREATE);
cRequest.setCustomerId(“customer123”)
.setPaymentType(PaymentType.CC)
.setFrequency(PaymentFrequency.MONTHLY)
.setCardData(“4012888812348882”, “1216”)
.setCardCustomerData(“123 N. Main”, “55555”)
.setStartDate(“05”, “13”, “14”)
.setAmount(“1.00”)
.setPaymentCount(“0”);RbsResponse cResponse = rbs.run(cRequest);
System.out.println(cResponse);
if(cResponse.requestSuccessful()) {
// Store Results
}
} catch (MesRuntimeException e) {
e.printStackTrace();
}
When a MONTHLY transaction first runs on, for example JAN 31st, it will run on the last available day in the coming months: the Feburary payment would occur on the 28th.
Output
- rspCode=000&rspMessage=OK
Update record Example
Below, we’ll update a record for a specific customer ID, setting the customer data (Address and ZIP code) to new values.
Request
- RbsSettings settings = new RbsSettings()
.credentials(“testuser”, “testpass”, “9410000xxxxx0000000x”)
.hostUrl(RbsSettings.URL_LIVE)
.verbose(true);Rbs rbs = new Rbs(settings);try {
RbsRequest cRequest = new RbsRequest(RequestType.UPDATE);
cRequest.setCustomerId(“customer123”)
.setCardCustomerData(“123 N. Oak”, “54321”);RbsResponse cResponse = rbs.run(cRequest);
System.out.println(cResponse);
if(cResponse.requestSuccessful()) {
// Store Results
}
} catch (MesRuntimeException e) {
e.printStackTrace();
}
An update request cannot change the payment count, or start date. In these situations, we’ll need to delete the existing record, and create a new record.
Output
- rspCode=000&rspMessage=OK
Delete record Example
Below, we’ll delete a record for a specific ID. The only parameter necessary is the customer ID.
Request
- RbsSettings settings = new RbsSettings()
.credentials(“testuser”, “testpass”, “9410000xxxxx0000000x”)
.hostUrl(RbsSettings.URL_LIVE)
.verbose(true);Rbs rbs = new Rbs(settings);try {
RbsRequest cRequest = new RbsRequest(RequestType.UPDATE);
cRequest.setCustomerId(“customer123”);RbsResponse cResponse = rbs.run(cRequest);
System.out.println(cResponse);
if(cResponse.requestSuccessful()) {
// Store Results
}
} catch (MesRuntimeException e) {
e.printStackTrace();
}
Output
- rspCode=000&rspMessage=OK