Skip to main content

Sale: Jump to third-party payment

In the sale model, the customer is redirected from Shoplazza checkout to a third-party payment page to complete the transaction.

Sequence diagram steps

Redirect payment sequence diagram

  1. The customer selects a payment method and clicks to complete payment.
  2. The browser sends the payment request to the Shoplazza server.
  3. The Shoplazza server forwards the payment request to the payments app server.
  4. The payments app server returns a redirect URL to the Shoplazza server.
  5. The Shoplazza server sends the redirect URL back to the browser.
  6. The browser redirects the customer to the payment gateway page.
  7. The customer submits payment details on the payment gateway page.
  8. The payments app server calls the Complete Payment API.
  9. Shoplazza returns a redirect URL to the payments app server.
  10. If payment fails, the customer is redirected to the cancel_url provided in the payment request.
  11. If payment succeeds, the customer is redirected to the complete_url returned by Shoplazza.
  12. The customer is directed to the order payment result page.
  13. The payments app server sends the final payment result notification to the callback URL.
  14. Shoplazza acknowledges receipt of the notification with HTTP 200.

Payment request

When initiating payment, Shoplazza sends request headers and parameters to the payment system.

Request headers

HeaderDescription
Shoplazza-Shop-IdShop ID in the Shoplazza system.
Shoplazza-Shop-DomainSystem domain assigned by Shoplazza.
Custom-DomainDomain used by the current order.
Custom-IpCustomer device IP address.
User-AgentCustomer browser user agent.
Shoplazza-Request-IdUnique request ID.
Shoplazza-Api-VersionOpen API version.
Shoplazza-Hmac-Sha256Digital signature for request validation.
Customer-CpfTax ID number when applicable.

Request parameters

KeyRequiredTypeDescription
idYesstringPayment ID used for idempotency.
app_idYesstringPayments app ID.
account_idYesstringMerchant ID in the payment provider system.
shoplazza_order_idYesstringShoplazza order ID.
amountYesstringOrder amount with two decimal places.
currencyYesstringCurrency code, such as CAD.
productsYesstringSerialized JSON string for product information.
cancel_urlYesstringURL used when the customer cancels payment.
complete_urlYesstringSynchronous payment completion callback URL.
callback_urlYesstringAsynchronous payment notification callback URL.
customer_emailNostringCustomer email.
customer_phone_numberNostringCustomer phone number.
customer_billing_*VariesstringBilling address fields.
customer_shipping_*VariesstringShipping address fields.
testNobooleanWhether the request is in test mode.
typeYesstringPayment type. Use sale for redirect payment.
timestampYeslongRequest timestamp.

Response

For a successful payment session creation, return the third-party payment page URL.

{
"redirect_url": "https://payment-gateway.example/pay"
}

For failures, return an error code and message.

{
"code": "ERR-1234",
"message": "Invalid amount"
}