How to Request a Payment
Before checking out a basket using Deliverect Pay (DPay), the commerce platform must first initiate a payment request to the payment provider.
1. Get Payment Gateway
It will provide a the available payment methods on a given store (channelLinkId) under a customer account. See API documentation here.
Payment Gateways Configuration
Payment Gateways need to be created, configured, and linked to stores by the merchant before they can be used during the basket checkout process. For more information of how Payment Gateways are managed in Deliverect, please read this article from our Help Centre.
Types of Payment Gateways
Merchants can create online and offline Payment Gateways in Deliverect. As the name suggests, Online Payment Gateways allow end users to complete checkout paying through an an online payment service (e.g. Adyen, Stripe, etc), and Offline Payment Gateways allow to go through checkout indicating that the payment will happen outside the scope of a commerce integration.
For a Dpay integration, only gateways with "paymentType": "online" are relevant by supporting the required redirection. Any non-online gateway can be safely ignored.
[
{
"id": "68e79ac****01c94d3044",
"integration": 1,
"paymentType": "online"
}
]2.Payment Request
Initiates a payment request with the selected provider and returns a redirect URL to complete the transaction. The payment remains pending until the transaction is finalized. See API documentation here
The commerce platform must redirect the user to the provided URL.
{
"paymentId": "68ed22c5***",
"gateway": 1,
"paymentStatus": "pending",
"action": {
"type": "redirect",
"url": "https://checkout.providerredirect.com/c/pay/******g1a5cPaz2fbIdRRRmHXVKMi6rG7AljRysCBFY77U1BS64H#fidnandhYHdWc***********ndqcGthRmppancnPycmY2NjY2NjJyknaWR8anBxUXx1YCc%2FJ3Zsa2JpYFpscWBoJyknYGtkZ2lgVWlkZmBtamlhYHd2Jz9xd3BgeCUl"
}
}3. Payment update webhook URL
Set a Payment update webhook URL via the channel setting below;
{
"paymentId": "6***2c****c***dda6636",
"status": "authorized",
"metadata": {
"gatewayProfileLinkId": "68ed22c5***",
"methodRaw": "visa"
}
}After the payment has been confirmed via the
"status":"authorized"via the payment update webhook URL, the checkout of the basket can proceed.As an alternative, use GET Payment endpoint to poll the current status.
Available endpoints
The following endpoints are available for Payment requests.
| Endpoint | Type | Method | Purpose |
|---|---|---|---|
| GET Payment Gateways | Pay API endpoint | GET | Retrieve the payment methods linked to the store (= channelLinkId). |
| Request payment | Pay API endpoint | POST | Request a payment from the connected payment provider. |
| GET Payment | Pay API endpoint | GET | Retrieve the products inside an account |
Available webhooks
The following webhooks are available for Payment requests.
| Endpoint | Type | Method | Purpose |
|---|---|---|---|
| Payment update webhook URL | Pay API webhook | POST | URL set to receive payment updates |
Updated 5 days ago