# JS-SDK CDN & API Endpoints

# CDN

DEVELOPMENT

 

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

# Endpoint

DEVELOPMENT

 

https://dev.directpay.lk/v1/mpg/api/external/cardManagement
1

PRODUCTION

 

https://prod.directpay.lk/v1/mpg/api/external/cardManagement
1

# How to Integrate

Card Add
  • Go to the link provided below. Copy the code to your application (Ex: vscode). Edit and insert your ‘merchantId’
  • (URL: https://developer.directpay.lk/ - in the ‘integration’ tab)

  • 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).

  • Enter ‘customerEmail’ and ’customerMobile’.
  • (Manual insertion of 'customerEmail' is only done in Sandbox testing).

  • Enter a ‘cardNickname’

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

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

  • 3 types of responses SuccessResponse, ErrorResponse, TransactionFailed.
  • (URL: https://doc.directpay.lk/userWiseCard/cardAdd.html - in the ‘Home’ tab).

    Card List
  • Go to the link provided below. Copy the code to your application (Ex: vscode). Edit and insert your ‘merchantId’
  • (URL: https://developer.directpay.lk/#/ - in the ‘integration’ tab)

  • Enter your 'merchantId', 'reference' and 'cardId'.
  • Your api-key is provided in your account. (URL: https://developer.directpay.lk/#/ under the ‘integration’ tab)

    Signature will be generated by running the 'Signature generate' script below.

    Please download the private key from (URL: https://developer.directpay.lk/ and link the file to the '$pkeyid' variable.

  • Transfer your 'filename.php' to your server.
  • (localhost Ex: www directory in wamp server or htdocs in xampp)

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

  • 3 types of responses SuccessResponse, ErrorResponse, TransactionFailed.
  • (URL: https://doc.directpay.lk/userWiseCard/cardAdd.html - in the ‘Home’ tab).

    Card Delete
  • Go to the link provided below. Copy the code to your application (Request). Save the file as filename.php

  • Enter your Signature and the x-api-key.
  • (URL: https://developer.directpay.lk/ - in the ‘integration’ tab)

    Your api-key is provided in your account. (URL: https://developer.directpay.lk - under 'Integration' tab)

    Please downloa your private key from (URL: https://developer.directpay.lk/ and link the file to the '$pkeyid' variable.

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

  • 3 types of responses SuccessResponse, ErrorResponse, TransactionFailed.
  • (URL: https://doc.directpay.lk/userWiseCard/cardAdd.html - in the ‘Home’ tab).

    Payments using selected card
  • Go to the link provided below. Copy the code to your application (Request). Save the file as filename.php

  • Enter your ‘merchantId’, ‘reference’, ‘cardId’, ‘refCode’ and ‘amount.
  • Your api-key is provided in your account. (URL: https://developer.directpay.lk/ under the 'Integration tab')

  • Signature will be generated by running the 'Signature generate' below script

  • Please download your private key from
  • (URL: https://developer.directpay.lk/ and link the file to the '$pkeyid' variable.

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

  • 3 types of responses SuccessResponse, ErrorResponse, TransactionFailed.
  • (URL: https://doc.directpay.lk/userWiseCard/cardAdd.html - in the ‘Home’ tab).