# CDN

DEVELOPMENT

 

<script src="https://cdn.directpay.lk/dev/v1/directpayCardPayment.js?v=1"></script>
1

# How to Integrate

ONE TIME PAYMENT

How does it work?

  • Go to the link provided below, copy the ‘Request’ script to your application. (Ex: vscode).
  • URL: https://doc.directpay.lk/cardPayment/oneTime.html

  • In the script, insert your ‘merchantId’ which is provided by DirectPay.
  • (URL: https://developer.directpay.lk/ - In the ‘Integration’ tab) Example: [ merchantId: ‘IT02065’ ]

  • Enter a desired ‘amount’ in the script
  • (Manual insertion of ‘amount’ is only done in Sandbox testing).

  • In the ‘refCode’, please enter the ‘Order Id’
  • (URL: https://developer.directpay.lk/ - In the ‘Transactions’ tab). (Manual insertion of ‘refCode’ is only done in Sandbox testing).

  • Insert the currency of your choice. (LKR or USD).

  • Enter the customer email in the ‘customerEmail’ section.
  • (Manual insertion of ‘customerEmail’ is only done in Sandbox testing)

  • Insert the description of the product or service that you provide.
  • (Manual insertion of ’description’ is only done in Sandbox testing).

  • ‘apiKey’ is provided in your account.
  • (URL: https://developer.directpay.lk/ - In the ‘Integration’ tab).

  • Save the file as a HTML file. Open the saved file using a web browser.

  • Insert a test card number provided by DirectPay and click on ‘Pay’.
  • (URL: https://doc.directpay.lk/ - in the ‘Home’ tab). (for sandbox testing only)

  • In the ‘verification online payment’ page, select ‘(Y) Authentication Successful’ in Authentication Result.
  • (for sandbox testing only; In the live version, instead of this page, your bank’s online payment verification [OTP] will be displayed here)

  • Click Submit.

  • A popup (message) ‘Browser Response’ from the server will appear on your web browser.

  • There are 3 types of responses: SuccessResponse, ErrorResponse and TransactionFailed.
  • (URL: https://doc.directpay.lk/cardPayment/recurring.html#get-response-from-server - in the ‘Home’ tab).

  • Nature of the payment will be displayed whether it’s Successful or Declined. Amount, Transaction ID, Date and Time will be displayed on it.
  • RECURRING PAYMENT

    How does it work?

  • Go to the link provided below. Copy the code to your application (Ex: vscode).
  • URL: https://doc.directpay.lk/cardPayment/recurring.html

  • In the script insert your ‘merchantId’ which is provided by DirectPay.
  • (URL: https://developer.directpay.lk/ - In the ‘Integration’ tab) Example: "merchantId: ‘IT02065’ "

  • Enter a desired ‘amount’ in the script
  • (Manual insertion of ‘amount’ is only done in Sandbox testing).

  • In the ‘refCode’, please enter the ‘Order Id’
  • (URL: https://developer.directpay.lk/ - In the ‘Transactions’ tab). (Manual insertion of ‘refCode’ is only done in Sandbox testing).

  • Insert the currency of your choice. (LKR or USD).

  • Enter the start payment date under ‘startPaymentDate’.
  • (format: yyyy-mm-dd; Ex: 2021-01-20).

  • Enter the last payment date under ‘lastPaymentDate’.
  • (format: yyyy-mm-dd; Ex: 2025-01-20)

  • 'Interval' is how often you need to charge your client.
  • (Ex: DAILY, MONTHLY, YEARLY) (only done in Sandbox testing environment).

  • Select the recurring amount that you will charge the customer ‘recurringAmount’.
  • (Ex: 50.00)

  • Enter the customer email in the ‘customerEmail’ section.
  • (Will change according to the customer)

  • Insert the description of the product or service that you provide.
  • (will change according to the customer)

  • ‘apiKey’ is provided in your account.
  • (URL: https://developer.directpay.lk/ - In the ‘Integration’ tab

  • Save it as an HTML file. Use a web browser to run the file.

  • Insert the test card number provided.
  • (URL: https://doc.directpay.lk/ - in the ‘Home’ tab). (only done in the Sandbox testing environment).

  • In the ‘verification online payment’ page, select ‘(Y) Authentication Successful’ in Authentication Result.
  • (for sandbox testing only. In the live version, instead of this page, your bank’s online payment verification [OTP] will be displayed here)

  • Click Submit.

  • A popup (message) ‘Browser Response’ from the server will appear on your web browser.

  • There are 3 types of responses: SuccessResponse, ErrorResponse and TransactionFailed.
  • (URL: https://doc.directpay.lk/cardPayment/recurring.html#get-response-from-server - in the ‘Home’ tab).

  • Nature of the payment will be displayed whether it’s Successful or Declined. Amount, Transaction ID, Date and Time will be displayed on it.