Payment gateways
A customer can pay an order online right after placing it in the shop. Tienda supports two payment services (gateways), for Caribbean Netherlands shops.
| Gateway key | Service | Shown to the customer as |
|---|---|---|
sentoo | Sentoo | Sentoo |
pagadirect-ideal | PagaDirect | iDEAL |
pagadirect-credit-card | PagaDirect | Credit card |
Paying on collection or delivery stays the other choice. Each shop uses its own account at the gateway.
What has not been verified
- Payments through Sentoo and PagaDirect, pay links and renewals by pay link have automated tests but no record of use in a live shop. Treat them as new.
- A refund recorded in Tienda does not refund the card. Refund the payment at the payment provider as well.
The flow
- The shop creates the order. For a web order the answer carries a
payment_token: a signed token, valid for 7 days, that lets this customer pay this one order. - The "order placed" page asks which gateways the shop offers. A gateway is offered only when it is switched on in the shop's payment settings and its credentials are present.
- The customer chooses one. Tienda records a transaction for what is still due
on the order, creates the payment at the gateway with the shop's credentials,
and answers a
payment_url. The browser goes there. - The gateway sends the customer back to the shop's
/payment/returnpage. The address is built by Tienda from the shop the request came from; the browser cannot choose it. - The return page asks Tienda for the transaction's state every few seconds for about a minute: paid, pending, failed, cancelled or expired. While it is pending, Tienda asks the gateway itself. Whatever the gateway put in the return address is ignored.
- Independently, the gateway's webhook and a polling job confirm the payment, so the order is paid even when the customer never comes back.
When a payment counts
A transaction changes state only from what the gateway's own API answers, never from the body of a webhook or from the return address.
- When the gateway says paid, Tienda makes one order payment and marks the transaction completed. This happens once, even when the webhook, the polling job and the return page all arrive together.
- An order that was waiting for payment moves to paid. An order in any other status keeps its status and shows as paid through its payments.
- Failed, cancelled and expired are recorded on the transaction. The order stays placed and unpaid. A paid transaction is never changed back.
- A transaction is open for one hour.
Webhooks Tienda receives
| Gateway | Address | Set up |
|---|---|---|
| Sentoo | POST https://<your Tienda API host>/webhooks/sentoo | Register it in the Sentoo merchant portal. |
| PagaDirect | POST https://<your Tienda API host>/webhooks/paga_direct | Sent with every payment as its callback address; nothing to register. |
A webhook is only a hint. Tienda finds its own transaction and asks the gateway's API for the real status.
Polling
A job runs every five minutes. It checks every pending transaction with the shop's credentials and expires the overdue ones.
When the gateway cannot be reached
The clients use a 10 second connect and 15 second read timeout and retry up to
three times with a short wait. Creating a payment is retried only when the
connection could not be opened, so a payment is never created twice. If the
gateway stays unreachable, starting a payment answers 503 with
code: gateway_unreachable, and the shop tells the customer to try again or pay
on collection.
Settings
A shop administrator sets these under Settings, Payment Gateways:
| Setting | Meaning |
|---|---|
| Sentoo on/off, merchant id, merchant secret | The shop's own Sentoo account. The secret is never sent back to the browser. |
| Sentoo test mode | Talk to Sentoo's sandbox. Off means production. |
| PagaDirect on/off, API token | The shop's own PagaDirect account. The token is never sent back. |
| PagaDirect test mode | Talk to PagaDirect's test API. Off means production. |
| PagaDirect callback address | Optional fixed address. Empty means the default above. |
There is no test mode by default: a shop that has not switched on test mode talks to production. Operator variables for these gateways are listed in Configuration.