To add Delay Pay to your payment page, complete the following steps in order:
Building on your existing Hosted Fields setup, Delay Pay uses the same checkout foundation you already have. You don’t need to change your card fields, validation or initialization.
Add the Delay Pay button, configure it to open the loan page in an iFrame and handle the result. On approval, you’ll receive a temporary token that you can send to the server-side to create the Loan Sale.
paymentRequestLoanButton).<button type="button" id="paymentRequestLoanButton" style="color:green">{Name of button}</button>You must handle loan flow responses separately from your card form events, so card payments and Delay Pay don’t interfere with each other.
Update your checkout page with the following configuration. When the customer clicks the Delay Pay button this opens an iFrame and handle the response once the customer completes the payment flow.
const paymentRequestACFForm = GlobalPayments.acf.acfform(
"#paymentRequestLoanButton", {
merchant_key: < YOURMERCHANTKEY >
}, {
loan: {
country_code: "840",
language: "en-US",
amount: "250",
currency_code: "840",
},
}, {
styleOptions: {
"#iframe": {
position: "fixed",
top: "0",
left: "0",
"border-style": "none",
width: "100vw",
height: "100vh",
},
},
}
);
paymentRequestACFForm.on("gpi-acf-success", (resp) => {
console.log("ACF response token is here", resp);
});
paymentRequestACFForm.on("gpi-acf-error", (resp) => {
console.log("ACF error response is here", resp);
});
paymentRequestACFForm.on("error", (resp) => {
console.log("payment api error is here", resp);
});Your JavaScript should listen for the response from the Lender:
On the server-side, use the temporary token returned after approval to a Loan Sale using our REST API.
Content-Type: application/json
Authorization: AuthToken {AuthTokenV2}
X-GP-Request-Id: {request_id}
X-GP-Version: 2021-04-08
X-GP-Api-Key: {API Key}
X-GP-Source-App-Version: {Version of integrating application}
X-GP-Source-App-Name: {Name of integrating application}
{
"reference_id": "XAZR863990",
"loan": {
"temporary_token": "fa8859e6-eec1-4289-a20b-de5ffc84c9da"
},
"payment": {
"invoice_number": "239087"
},
"transaction": {
"country_code": "840",
"language": "en-US"
}
}{
"loansale_id": "0000000000000092451",
"status": "approved",
"processor_response": "",
"payment": {
"amount": "250.00",
"currency_code": "840",
"invoice_number": "cdd78ff-9e71-f0d001120550",
"type": "loan"
},
"transaction": {
"country_code": "840",
"language": "en-US"
},
"links": [
{
"loansale_id": [
{
"href": "https://api.pit.paygateway.com/transactions/loansales/0000000000000092451/loanreturns",
"relation": "self",
"method": "POST",
"description": "Use this endpoint to create a returns transaction associated with a previous loan sales transaction."
},
{
"href": "https://api.pit.paygateway.com/transactions/loansales/0000000000000092451/voids",
"relation": "self",
"method": "PUT",
"description": "Use this endpoint to void a previous loan sales transaction by loansale id."
},
{
"href": "https://api.pit.paygateway.com/transactions/loansales/0000000000000092451",
"relation": "self",
"method": "GET",
"description": "Use this endpoint to retrieve a previous Loan Sale transaction."
}
]
},
{
"reference_id": [
{
"href": "https://api.pit.paygateway.com/transactions/loansales/reference_id/XAZR863990/loanreturns",
"relation": "self",
"method": "POST",
"description": "Use this endpoint to create a returns transaction associated with a previous loan sales transaction."
},
{
"href": "https://api.pit.paygateway.com/transactions/loansales/XAZR863990/voids",
"relation": "self",
"method": "PUT",
"description": "Use this endpoint to void a previous loan sales transaction by loansale id."
},
{
"href": "https://api.pit.paygateway.com/transactions/loansales/reference_id/XAZR863990",
"relation": "self",
"method": "GET",
"description": "Use this endpoint to retrieve a previous Loan Sale transaction."
}
]
}
],
"reference_id": "XAZR863990"
}For additional capabilities and shared details - like follow on transactions, supported codes, error references etc, see: