Documentation
Ask or search…
K
Links

Integrating with your e-services

The following describes what you can expect when integrating your e-service with PaySG.
Expected inputs and sample responses for each endpoint can be found here.
Integration FAQs can be found here.

Integrated payment flow

The following describes the overall flow of how a successful payment integration would work when a payer enters your e-service to make a payment.

Creating a payment

  1. 1.
    The payer accesses your e-service.
  2. 2.
    Your e-service initiates a payment on PaySG through a POST API call to the relevant endpoint to create a new payment. If necessary, your team can include a return_url which will be used to redirect users after successful payment. Please note that the return_url must be a valid HTTPS URL, otherwise, the payment creation will be blocked by PaySG.
  3. 3.
    The PaySG server returns a payment object to your e-service.
  4. 4.
    Your e-service then needs to redirect the payer to the payment_url, found in the payment object, which leads to PaySG's payment page.
  5. 5.
    The payer completes the payment on the PaySG payment page.

Redirecting payers back after successful payment

  1. 1.
    Upon successful payment, the PaySG payment page redirects the payer back to the return_url provided by your team.
  2. 2.
    Your e-service receives the paysg_payment_id and paysg_payment_service_id and makes a GET API call to PaySG to verify the payment status.
  3. 3.
    The PaySG server responds by returning the payment status.
  4. 4.
    If the payment status is confirmed as paid, your e-service marks the payment as paid and allows the payer to continue with their e-service flow.

Configuring Return URL

Integrators have the ability to set the return URL (the URL to which payers are redirected after successful payment) when creating a payment on PaySG. To do this, include an additional property return_url when creating a payment. Please note that the return_url must be a valid HTTPS URL, otherwise, the payment creation will be blocked by PaySG.

Checking Payment Status

When payers are redirected to the configured return_url, the PaySG payment ID and payment service ID will be included in the URL search parameters associated with the keys paysg_payment_id and paysg_payment_service_id respectively.
For instance, if the return_url configured is https://google.com, then payers will be redirected to https://google.com?paysg_payment_id=<payment_id>&paysg_payment_service_id=<payment_service_id>.
The paysg_payment_id and paysg_payment_service_id should be used to query the payment state on PaySG through the GET payment API endpoint. The response from this query should then be used to update your e-service accordingly.