API integration
Use Yera Connect endpoints from a custom backend.
Use the API when you have a custom backend and want to create checkout sessions directly.
API integration gives merchants more control than payment links or plugin-only setup. It is best for custom ecommerce platforms, marketplaces, SaaS billing flows, or backend systems that need to attach internal order metadata.
Basic flow
- Create a server-side API key.
- Send checkout session details from your backend.
- Store the returned session ID.
- Redirect the customer to the returned checkout URL.
- Listen for webhooks.
- Update your internal order status.
Create a checkout session
Direct API integrations create sessions with:
POST https://yeraconnect.io/api/v1/checkout-sessions Authorization: Bearer yera_test_sk_REPLACE_WITH_SECRET Content-Type: application/json
Example payload:
{
"amount": "100.00",
"countryCode": "NL",
"currency": "EUR",
"destinationAsset": "USDC",
"network": "Polygon",
"customerEmail": "customer@example.com",
"orderId": "order_10482",
"redirectUrl": "https://merchant.example.com/checkout/complete"
}
amount and countryCode are required. currency can be omitted when the country should decide the default checkout currency.
WooCommerce plugins use a separate order-shaped route:
POST https://yeraconnect.io/api/v1/checkout/sessions
That route expects WooCommerce fields such as order_id, order_key, store_url, success_url, cancel_url, callback_url, and webhook_secret.
Recommended backend data model
Store these references in the merchant backend:
- Internal order ID
- Yera payment session ID
- Customer email
- Amount
- Fiat currency
- Checkout URL
- Session status
- Transaction ID when available
- Last webhook event ID
This makes support, reconciliation, and retry handling easier.
Security rules
- Keep secret keys server-side.
- Validate webhook signatures.
- Store session IDs with internal order IDs.
- Do not trust browser-only status updates.
Webhook signature verification
Yera Connect sends merchant webhooks with these headers:
yera-delivery-idyera-event-idyera-event-typeyera-timestampyera-signature
The signature header format is:
t=<timestamp>,v1=<hex_digest>
Verify it by computing:
hex(hmac_sha256(webhook_secret, `${yera-timestamp}.${rawRequestBody}`))
Use the raw request body for verification. Parse JSON only after the signature matches.
API integration direction
- Complete dashboard setup.
- Create sandbox API keys.
- Build server-side checkout session creation.
- Redirect customers to the returned checkout URL.
- Add webhook handling.
- Update internal order status from webhook events.
- Test sandbox payments.
- Review dashboard sessions and transactions.
- Rotate to live keys only after live approval.
Common mistakes
Avoid:
- Calling secret-key endpoints from browser JavaScript.
- Creating orders without saving the Yera session ID.
- Using redirects as the only proof of payment.
- Ignoring webhook failures.
- Mixing sandbox keys with live checkout.
