Processing payments

Important

This page describes a necessary step in the direct API integration process. It assumes the previous checkout integration step has been completed.

If you are using an e-commerce platform such as Magento, Woocommerce or Salesforce, this section is not relevant to your integration of Limepay.

With the initial stage of integration complete, you are now ready to configure the customer payment process. Follow these steps to enable functional payment processing.

Workflow diagrams of the payment process can be found in the technical diagrams documentation page.

Step 1 - Retrieving the payment token from customer payments

When a customer makes a payment through the Limepay checkout, the system will generate a payment token which you can use to actualise a transaction.

Customers opting to pay now can select the Card payment option and will be asked to enter their card details. Customers opting to use the Pay in instalments option will be asked to enter their card details, verify their phone number and email address, and finally accept the terms and conditions. In both cases, these actions will generate a paymentToken.

If you have not enabled the “Pay Now” or “Submit Payment Plan” options in the limepay.render() method, you can instead initiate these checks using the limepay.submit() method.

If you have added a “Place Order” button to your checkout, it can check if the payment token has been generated already and call limepay.submit() if it hasn’t. limepay.submit() will then process the required details and return the paymentToken via the paymentToken callback.

Once you have the paymentToken, pass this to your backend server to initiate the next steps.

Step 2 - Creating an order

When a customer completes the checkout process, an order with Limepay will need to be created. Use the following POST request made from your backend server to the Order [Create] API endpoint.

Step 3 - Completing a payment process

Once an order has been created you will receive an order ID. To complete the transaction and receive your money, make a POST request from your backend server with your secret API key to the Order [Pay] API endpoint using the order ID and payment token.

requestjson
Copy
Copied
POST https://api.limepay.com.au/orders/ordr_YuceOqGnzB6DXse8/pay
Limepay-SecretKey: YOUR_SECRET_KEY
Accept: application/json
Content-Type: application/json

{
  "paymentToken": "ptkn_YucebqEqox6brME1"
}
Copy
Copied
{
  "transactionId": "tran_YvrnkXYqUW-2JsB1",
  "transactionStatus": "paid",
  "amount": 60000,
  "currency": "AUD",
  "type": "paycard"
}
Important

You should only set the paymentActionRequired field if you are handling a payment action response when paying for an order. Otherwise, the field should be omitted or set to null. See Handling errors and payment actions to learn more.

If the payment is successful, you will receive a response with the transactionId and the transactionStatus. If the payment is unsuccessful, you will get a response like below:

Copy
Copied
{
  "statusCode": 400,
  "errorCode": "do_not_honor",
  "message": "Error encountered trying to process this transaction with the payment gateway",
  "tracer": "329473b4-9e66-4354-aae4-a2170826c289",
  "detail": "Declined - Do Not Honour",
  "errorTypeDescription": "The server is unable to process the request due to client error. Most common reasons are a malformed request syntax or values."
}

The API documentation details all the errorCode's your integration should be prepared to handle. Additional information is provided in Handling errors and payment actions.

Step 4 - Initiating a refund

To initiate a refund for a successful transaction, create a refund with Limepay with the following POST request made from your backend server with your secret key to the Refund [Create] API endpoint.

Copy
Copied
POST https://api.limepay.com.au/refunds
Limepay-SecretKey: YOUR_SECRET_KEY
Accept: application/json
Content-Type: application/json

{
  "transactionId": "tran_YvrnkXYqUW-2JsB1",
  "refundAmount": {
    "amount": 45000,
    "currency": "AUD"
  }
}

What's next?

Important

The integration is not yet finished. These next steps must be completed to gain full functionality.

Handling errors and payment actions correctly to ensure payments are processed correctly.

If you have not yet finished the first stage of integration, return to the checkout integration page.

Visit the testing documentation page to confirm the integration is fully functional.

Return to the initial direct API integration landing page.



Return to documentation home.

Copyright © April Solutions 2023. All right reserved.