Skip to content

Redirect Checkout

Redirect mode is the simplest integration: create a Checkout Session server-side, then redirect the buyer to the Sangho session URL. Sangho handles the entire payment page.

Complete flow

  • 1. Server: Create a Checkout Session with success_url, currency, and line_items
  • 2. Server: Return the session URL to the client
  • 3. Client: Redirect to session.url
  • 4. Buyer: Pay on the Sangho-hosted page
  • 5. Sangho: Redirect to success_url after payment
  • 6. Server: Listen for the checkout.session.completed event via webhook

Advantages

  • No complex frontend code
  • Responsive and secure payment page maintained by Sangho
  • Automatic support for all enabled payment methods
  • 3D Secure handled automatically for cards
  • PCI-DSS compliant with no effort
Note

Redirect mode is recommended for the majority of e-commerce integrations. Use Embedded mode only if you need full control over the UX.

Create and redirect

bash
curl -X POST https://api.sangho.ga/v1/checkout-sessions/ \
  -H "Authorization: Bearer sk_prod_xxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "success_url": "https://mystore.com/thank-you",
    "cancel_url": "https://mystore.com/cart",
    "currency": "XAF",
    "line_items": [{"product": "prod_xxx", "quantity": 1}],
    "metadata": {"order_id": "CMD-001"}
  }'