Skip to main content

When to use Stripe

The released Stripe integration uses a server-created Stripe Checkout Session and a hosted redirect. It is not Stripe Elements. AvraAPI Payment Elements can display a Stripe card and hand the customer to the prepared Checkout URL, but all provider authentication, session creation, webhook verification, and completion stay on your backend.
The shared UPG lifecycle—availability, createOrder(), and completePayment()—is documented in Quick Setup. This page covers only Stripe-specific callback and return handling for the released Checkout flow.

SDK Functions

Preserve a signed Stripe webhook

Stripe signature verification depends on the unchanged raw request bytes. Read the body before parsing JSON and pass the exact Stripe-Signature header. The wrapper Base64-encodes the raw bytes only for safe JSON transport to AvraAPI; it does not alter the bytes used for verification.
SDK response — StripeWebhookPayload::toArray():
The original body and signature remain server-only. Do not parse then re-encode the body, and do not send it to a browser, log it, or store it in analytics.

Prepare a Stripe browser-return payload

The success URL may return a Stripe Checkout Session ID beginning with cs_. That value identifies the prepared session but is not proof of payment. The SDK wrapper accepts only a Checkout Session ID and sends it as the return observation for common completion.
SDK response — StripeReturnPayload::toArray():
The wrapper rejects a value that does not start with cs_. During completion, AvraAPI checks it against the Checkout Session ID bound when the order was created, then retrieves that session from Stripe.

Complete a Stripe payment

Use the stored completion context with the webhook payload or return payload. A supplied valid webhook must be one of the supported Checkout Session events; AvraAPI then retrieves the exact server-created Checkout Session, validates its binding, amount, currency, environment, and payment state, and produces the canonical result. Stripe retrieval cannot be disabled.
SDK response — PaymentCompletionResult:
The result has $result->gateway, $result->verified, $result->paymentStatus, $result->providerStatus, $result->gatewayReference, and $result->reconciliation. A session with payment_status: unpaid is pending while open, failed when complete, or cancelled when expired. A retrieval outage is unknown and must be retried from your backend.

Payment Elements

Payment Elements does not load Stripe.js or Stripe Elements in this integration. It displays a normal redirect method and sends the customer only to the public Stripe Checkout URL created by your backend.
For rendering, visual customization, events, and the checkout lifecycle, see More Payment Elements features.

Gateway-specific options

Stripe payment-method types are configured in the Gateway Vault. When no allowed-type list is configured, Stripe Checkout uses the merchant account’s Dashboard defaults. A browser cannot submit a Stripe secret key, webhook signing secret, account context, API version, payment method type, or checkout amount through providerOptions. The success URL and cancel URL are provider configuration resolved by your backend. AvraAPI adds Stripe’s Checkout Session placeholder to the configured success return URL and never exposes the server-only completion context.

Completion, webhooks, and safety

Register a Stripe webhook endpoint for the exact Checkout Session event types supported by this release: checkout.session.completed, checkout.session.async_payment_succeeded, and checkout.session.async_payment_failed. Preserve raw bytes and the Stripe-Signature header, then let shared completion verify and reconcile the bound session. The browser return is informational only. Fulfil only when verified is true and paymentStatus is succeeded; do not trust browser navigation, a cs_... value, or a webhook without valid raw-body signature verification.
Last modified on October 1, 2026