For the complete documentation index, see llms.txt. This page is also available as Markdown.

Test Hosted Payment Page API

After you set up accepting payments in Coda Portal, you can quickly test a payment flow for a payment method.

This tutorial only shows how to test for a specific payment method. If you are interested in our Payment Selection Page, you can follow this guide.

What you'll learn

  • Initiating a payment request.

  • What your customer will experience upon payment request.

  • What your customer will experience upon a successful payment notification.

This tutorial assumes you have a developer set up and tools to make API calls (Postman, ...). If that is not the case, you can also test the flow through our Coda Portal "Sandbox Testing" section.


Step 1: Initiate the payment request

  1. Initiate the payment request by calling the /init endpoint to collect your payment transaction ID. Use the curl below and populate it with:

Parameter
Placeholder text
Description

country

The country that you want to test. See the full list here.

currency

The currency code that you want to use. See the full list here.

payType

The payment method that you want to use. See the full list here.

apiKey

Get your APIKey from Coda Portal.

projectId

*This field is only needed for v2.0 API

Get the projectId for each title from Coda Portal.

Other parameters have been populated with dummy data for testing purposes below. They can be changed and populated properly as part of your integration. More details on the parameters of the /init endpoint can be found here. Codapay offers two API versions - v1.0 and v2.0, with v2.0 being an upgraded version. If you are a new merchant, please use v2.0. More details can be found here.

Below is an example using a dummy sandbox API Key for Singapore, with Singapore Dollar (SGD) as a currency and Card Payments as a payment method.


Step 2: Redirect your user to the payment page to complete payment

  1. Use the received txnId from Step 1 to redirect your user to the following URL:

Below is an example of what it would look like for the transaction initiated above for Card Payments in Singapore:

https://sandbox.codapayments.com/airtime/begin?type=3&txn_id=7122167282516076304
https://sandbox.codapayments.com/airtime/begin?type=3&txn_id=7122167282516076304&browser_type=mobile-web
  1. In the sandbox environment, you can follow the testing instructions provided here to complete the payment.

Complete a test transaction with Card Payments in Singapore and use the following test card below.

Card number
Expiry date
CVC

Step 3: Receive the successful payment notification

  1. You will receive a notification on the Complete Notification URL, including the following fields as query parameters:

Parameters
Description

TxnId

Coda transaction ID

OrderId

OrderId passed by you in the init request

ResultCode

Payment status (e.g. success = 0)

TotalPrice

Total price paid by the user for the transaction

PaymentType

Payment Channel ID chosen by the user

Checksum

A checksum to verify that messages have not been altered

  1. Respond to this notification with a success message ResultCode=0 or a failure message (including an appropriate error code).

If you want to try receiving an error response, simply replace the error code digit with any of the available error codes, which you can access here.


Step 4: Check the status of a successful payment using the InquiryPaymentResult API call

Use the InquiryPaymentResult API call below to inquire about the payment status of your transaction.

Next steps

Last updated

Was this helpful?