0
0

Payment Gateway Reference Manual

Docs
Docs EInnovator Posted 10 Jun 20

#Java / Spring Boot Client Library for SSO Gateway

Overview

Getting Started

@Autowired
private PaymentsClient paymentsClient;

External Configuration

Table below provides a quick summary for the configuration options:

PropertyTypeDefault ValueRequiredDescription
serverStringhttp://localhost:2060YesServer URL
connectionConnectionConfiguration NoConnection Settings

Connecting to the Server

Example: Configuring Server Access (application.yml)

social:
  server : "https://payments.mydomain.com"

Programmatic Configuration

Accounts API

Account CRUD

Example: Creating an Account

Address address = new Address()
	.withCountry("USA").withState("NY").withCity("NY")
	.withLine1("MainStreet 1").withLine2("LongRoad").withPostalCode("2815");
	Account account = new Account()
		.withUsername(username)
		.withPhone(new Phone("12-123-123"))
		.withAddress(address)
		.withCurrency(Currency.USD)
		.withEmail(email)
		.withVatNumber("12345678")
		;
URI uri = paymentsClient.createAccount(account, null, null);
String id = UriUtils.extractId(uri);		

Cards API

Example: Add Account Card

Account buyer = paymentsClient.getAccount(SecurityUtil.getPrincipalName(), null, null);
CreditCard card = new CreditCard()
	.address(new Address().country("USA").city("NY").line1("Main Street 1"))
	.cardType(CardType.VISA_DEBIT)
	.currency(Currency.USD)
	.cvc("123")
	.number("4000056655665556")
	.expirationMonth(11)
	.expirationYear(2020)
	.last4("1234")
	.name("TDD Jack")
	;
URI uriCard = paymentsClient.addCard(card,user.getId());
String cardId = paymentsClient.extractId(uriCard);

BankAccounts API

Payments API

Example: Building a Payment

public static final PRICE_MONTLY = new BigDecimal("12.00");
public static final PAYABLE = "ACME Service Subscription";
public static final PAYABLE_CATEGORY = "SasS";
public static final PAYABLE_DESCR = "Monthly Fee";

public Payment makeSubscriptionPayment(Account buyer) {
	Payable payable = new Payable()
		.withName(PAYABLE)
		.withCategory(PAYABLE_CATEGORY)
		.withDescription(PAYABLE_DESCR)
		.withImg(application.getIcon());	
	return new Payment()
		.withAmount(PRICE_MONTLY)
		.withCurrency(Currency.USD)
		.withBuyer(buyer)
		.withPayable(payable)
		.withStatement(payable.getName());
}

Example: Submitting Payment and Attempt Charging a Payment

Account buyer = paymentsClient.getAccount(SecurityUtil.getPrincipalName(), null, null);
Payment payment = makePayment(buyer);
URI uri = paymentsClient.submitPayment(payment, null, null);
String id = UriUtils.extractId(uri);
payment.setUuid(id);
paymentsClient.chargePayment(payment, null, null);

Taxes API

Comments and Discussion

Content