Getting Started

Quick Integration

Cashlesso enables you to accept payments from your customers in a swift manner. For this, you need to complete the integration process with our Standard Automatic Checkout. To do so, follow these steps:

  1. Paste the script for ‘Standard Checkout’ in your website
  2. Create ‘Order’ in your backend server
  3. Store fields in Database
  4. To ‘Checkout’, Pass ‘Order ID’
  5. Verify the Signature
  6. Make a Test Payment
  7. Switch to Live Mode

 

Note: You need to generate Test API Keys and create a Cashlesso Account as a prerequisite for quick integration.

Paste Standard Checkout script in your website

For invoking the ‘Checkout’ form, our Standard Automatic Checkout process provides you clients with a default Cashlesso Pay along with the Cashlesso button. The options for ‘Checkout’ form options are passed inside a <script> tag as data attributes. You can submit additional fields, visible or hidden, along with the form.

With this sample code given below, Cashlesso ‘Checkout’ options  will be passed as the HTML data attributes.

Insert Codes

After the completion of the checkout process, an additional field <name=id> will be added to the form containing the script tag. Post this, the form is submitted automatically. With the authorisation of the payment made, the form along with the Cashlesso_payment_id to the action url. 

 

Note: In the below mentioned code, replace the URL with the success callback URL of your website.

<form action=”https://www.example.com/payment/success/” method=”POST”>

Cashlesso provides its customers with the ‘Retry’ option in case of a failure.

Create ‘Order’ in the backend

The second step in quick integration is creation of an order in the backend. This is done using the Orders API. Below mentioned is a sample API request and the subsequent response for order creation.

Insert Codes

Once the order creation is completed successfully, the order_id is returned to be stored against the Order defined in your system.

Store fields in Database

Store the following objects in your database from Cashlesso:

cashlesso_order_id

string Order ID returned by Cashlesso Orders API.

Returned once the payment is completed by the customer.

cashlesso_payment_id

string Returned by Cashlesso API

only

for successful payments.

cashlesso_signature

string A hexadecimal string used for verifying the payment

 

Note: The unique identifier for an order in your system is not the the order_id returned by Cashlesso.

To ‘Checkout’, Pass ‘Order ID’

The order_id returned upon completion of the order, must be sent to the ‘Checkout’ form. In addition to this, an extra key-value pair must be sent as shown below.

Insert Codes

With the successful transaction, a cashlesso_order_id, cashlesso_signature and payment_id is received which is further used for verification of payment.

Verify the Signature

Signature verification is mandatory for successful verification of all authorised payments. Verify your payment using the signature verification step and decide if you want to complete it or not. The cashlesso_signature returned to you upon successful payment by the ‘Checkout’ form must be verified in your backend server.

For verification of payments, you must create a verification signature with SHA256 algorithm and verify it against the cashlesso_signature.

Create Signature

To create a signature in your server, use the attributes given below:

cashlesso_payment_id – Returned by Checkout

cashlesso_order_id – Returned by Checkout

key_secret – Available in your server

Using the SHA256 algorithm and cashlesso_order_id and cashlesso_payment_id, construct a HMAC hex digest as given below:

Insert Codes

 

Post Signature Verification Steps

Once the signatures are verified, you need to fetch the order in your system corresponding to cashlesso_order_id in your database. Process the order once it is marked as successful.

Note: cashlesso_order_id returned by successful order creation must be restored against the order created in the backend system. Once the signature is validated, mark the fetched order corresponding to cashlesso_order_id as successful.

 

Make a Test Payment

To initiate payment, click ‘Pay’ with CashlessoPay button. In a test payment, no money will be deducted from your account but the transaction is reflected in the dashboard. To know follow Dashboard → Transactions → Payments. 

Switch to Live Mode

Switch to the live mode if you have completed the integration process and tested it out. Create a Live Key from the Dashboard to replace the Test API Key.

Follow Us
© 2020 All Rights Reserved