API – Create New Payment Profile Process

Introduction

To create a payment profile in LMS, you will need to create the customer if they don’t already exist. Next, you should create the payment profile in Secure Payments. Finally, use the token in the Secure Payments response to create the payment profile in LMS. So, this process will involve making calls to both the LMS and Secure Payments APIs.

To create a customer, please refer to API – Creating a Customer.

Creating a Payment Profile in Secure Payments

Due to PCI-Compliance, LMS only supports creating a payment profile through an iframe. This will require an iframe and JavaScript on your web page.

To add the iframe, add the following HTML to your page (replace <obo token> with your obo token; replace <payment token> with your payment account token):

For adding card information:

<iframe src="https://securepayments.loanpro.io/api/capture-form/<YOUR OBO TOKEN>" style="width: 800px; height: 700px; border: 1px solid black;" 
frameborder="0" border="0" cellspacing="0">
<p>Your browser does not support iframes.</p>
</iframe>

For adding bank/checking account information:


<iframe src="https://securepayments.loanpro.io/api/check-capture-form/<YOUR OBO TOKEN>?account_type=<ACCOUNT TYPE>"
style="width: 800px; height: 700px; border: 1px solid black;" frameborder="0" border="0" cellspacing="0">
<p>Your browser does not support iframes.</p>
</iframe>

For editing card information:

<iframe src="https://securepayments.loanpro.io/edit-form/<obo token>?account=<payment token>" frameborder="0" border="0" cellspacing="0">
<p>Your browser does not support iframes.</p>
</iframe>

For adding bank/checking account information:


<iframe src="https://securepayments.loanpro.io/check-edit-form/<obo token>?account=<payment token>" frameborder="0" border="0" cellspacing="0">

<p>Your browser does not support iframes.</p>
</iframe>

You will also need to add a JavaScript event handler for the “message” event. When a payment account is successfully made for Secure Payments, it will emit a JavaScript message event with the payment token that will be stored in LMS. This token removes your server from needing to be PCI Compliant and you can store it in your own database, pass it to your own server, etc. To let your page handle the message event, add the following JavaScript to your code:

window.addEventListener("message", receiveMessage, false);

function receiveMessage(event) {
if(event.origin === 'https://securepayments.loanpro.io' && event.data.status == 200){
token = event.data.token;
}
}

You will need to send the payment profile token to LMS as outlined below. We recommend that this part is done on your server to avoid leaking your LMS API credentials.

Create Payment Profile in LMS

Once you have received your token from Secure Payments, you can now use it to create a payment profile inside of LMS. To do this, you’ll send a PUT request to the customer endpoint, which will include that customer's ID. Below is a sample request for a credit card:

PUT https://loanpro.simnang.com/api/public/api/1/odata.svc/Customers(<Customer ID here>)

{
"PaymentAccounts": {
"results": [
{
"active": 1,
"title": "(Credit Card Title)",
"type": "paymentAccount.type.credit",
"CreditCard": {
"token": "(credit card token)"
}
}
]
}
}

This table explains what each variable means:

Variable

Description

active

Whether or not the payment profile is active (1 – Yes, 0 – No)

title

Unique name for the payment profile

type

The payment profile type (see API – Payment Profile Collections for more details)

token

this is the token you received from Secure Payments of the token representing the payment profile

And here's a sample for creating checking account:

PUT https://loanpro.simnang.com/api/public/api/1/odata.svc/Customers(<Customer ID here>)

{ 
"PaymentAccounts":{
"results":[
{
"CheckingAccount":{
"accountType":"bankacct.type.checking",
"token":"(bank account token)"
},
"active":1,
"isPrimary":1,
"isSecondary":0,
"title":"Checking Account",
"type":"paymentAccount.type.checking"
}
]
}
}

As you can see, there a few differences in the formatting between “CheckingAccount” and “CreditCard”. The most important change is the designation of the “accountType” in the CheckingAccount. You’ll also need to have the type changes from paymentAccount.type.credit to paymentAccount.type.checking. Because of these differences, we will discuss the fields for both requests at the same time.

Variable

Description

token

This is the token you received from Secure Payments of the token representing the payment profile

isPrimary

Whether or not it is the primary payment profile for the customer (1 – Yes, 0 – No)

(There can only be one primary payment profile per customer)

isSecondary

Whether or not it is the secondary payment profile for the customer (1 – Yes, 0 – No)

(There can only be one secondary payment profile per customer. That is not to say that there can only be two payment profiles for a single customer. But only one is designated as the primary and only one is designated as the secondary.)

title

Unique name for the payment profile

type

The payment profile type (see API – Payment Profile Collections for more details)

active

Whether or not the payment profile is active (1 – Yes, 0 – No)


How did we do?


Powered by HelpDocs (opens in a new tab)