Salla Docs
Merchant
Merchant
  • Merchant API
  • Salla OAuth 2.0
  • Merchant Dashboard
Partner APIs
Partner APIs
  • App API
  • Shipments & Fulfillment APIs
  • Salla AWB
  • Recurring Payments API
  • App Functions
  • Billing System Salla partners
  • Report Builder
  • App Onboarding
  • Communication Apps
Storefront
Storefront
  • Twilight Engine
  • Twilight SDK
  • Web Components
  • Ecommerce Events
  • Component Bundle
  • Change Log
Salla CLI
Merchant
Merchant
  • Merchant API
  • Salla OAuth 2.0
  • Merchant Dashboard
Partner APIs
Partner APIs
  • App API
  • Shipments & Fulfillment APIs
  • Salla AWB
  • Recurring Payments API
  • App Functions
  • Billing System Salla partners
  • Report Builder
  • App Onboarding
  • Communication Apps
Storefront
Storefront
  • Twilight Engine
  • Twilight SDK
  • Web Components
  • Ecommerce Events
  • Component Bundle
  • Change Log
Salla CLI
Salla - Opensource
Salla - Developers Community
  1. Checkout Module
  • Embedded SDK
    • Overview
    • Getting Started
    • Installation
    • Authentication
    • App Design Guidelines
    • Create an Embedded App
    • Playground
  • Auth Module
    • Get Token
    • Client Introspect
    • Refresh Token
  • Page Module
    • Iframe Resizing
    • External Redirects
    • Navigation
    • Set Page Title
  • Nav Module
    • Create Navbar Action
    • Listen for Nav Actions
    • Clearing Nav Actions
  • UI Module
    • Confirm Dialogs
    • Toast Notifications
    • Loading States
  • Checkout Module
    • Create Checkout
    • Subscribe for Payment Result
    • Get App Add-ons
  • Endpoints
    • Token Introspect
  • Resources
    • Support
  1. Checkout Module

Subscribe for Payment Result

The onResult method registers a callback that is invoked whenever a checkout flow completes, whether the payment succeeded, failed, or was cancelled. This includes results that arrive after a 3DS redirect.

Usage#

API Reference#

embedded.checkout.onResult(callback)#

ParameterTypeRequiredDescription
callback(result: CheckoutResult) => voidYesCalled when a checkout completes.

Return Value#

TypeDescription
functionAn unsubscribe function to remove the listener.

CheckoutResult#

PropertyTypeDescription
successbooleantrue if the payment was completed successfully.
order_idstring | undefinedThe order ID, present on successful payment.
statusstringPayment status: "paid", "pending", "failed", "cancelled", or "success".
errorobject | undefinedError details with code and message properties.
contextunknown | undefinedThe context object passed to create(), restored after 3DS redirect.

3DS Redirect Recovery#

When a payment requires 3DS verification, the merchant is redirected away from the dashboard and back. The SDK handles this automatically:
1.
Before redirect, the host stores the pending checkout state (including your context).
2.
After redirect, the iframe reloads and the SDK delivers the stored result to your onResult callback.
3.
The context you passed to create() is preserved and returned in the result.
💡
Best Practices
Register Early: Set up onResult during your app's initialization, before any create() calls, to catch results from 3DS redirects that occurred in a previous session.
Clean Up: Call the unsubscribe function when your component unmounts to prevent memory leaks.
Handle All States: Always handle both success: true and success: false cases to provide clear feedback to the merchant.
Modified at 2026-02-11 20:23:15
Previous
Create Checkout
Next
Get App Add-ons