1. External Provider
BPN OpenAPI
  • Getting Started
    • Introduction to BPN
    • Key Concepts & Terminology
    • Architecture Overview
  • Onboarding & Prerequisites
    • Product Demo
    • Sandbox & Test Environment
    • Signature Authentication Mechanism
  • Use Case
    • Transfer
    • Vault
    • On/Off Ramp
    • Compliance (Travel Rule Information Submission)
    • Fiat Collection(BRL PIX for example)
    • Gaming - BRL Pay-in Business Integration Guide
  • API Reference
    • KYB
      • Share KYB/KYC Info For Sub User
      • Get KYB Sub User Status
    • Account Management
      • Inquiry Master VA Balance
      • List Primary Virtual Accounts
      • Create Virtaul Account
      • Get Virtual Account Detail
      • List Virtual Account
      • Send Email Verify Code
      • Query bank info by account number
      • Payout via Virtual Account
      • Refund Virtual Account Order
      • Get Virtual Account Order Detail
      • List Virtual Account Orders
      • Submit Invoice
      • Get Invoice list Status
      • List Banks
      • Add Bank Account
      • List Bank Account
      • List RFI Sub Virtual Account
      • Get Sub Virtual Account RFI Template Info
      • Sub Virtual Account Submit RFI
    • Wallet
      • List Wallets
      • List Sub Account
      • Create Sub Account
      • Wallet Internal Transfer
      • Query Wallet Internal Transfer Detail
      • List Wallet Internal Transfer order
      • Get Asset Balance
      • Get Deposit Address
      • Add Deposit Sender
      • Add Withdraw Whitelist
      • Delete Withdraw Whiltelist
      • Request Withdraw
      • Query Transaction History
    • FX
      • Inquery FX Rate
    • BPN Transactions
      • Get Stablecoin Quote
      • Create Stable Order
      • Get Order (Single) Detail
      • List Orders(Batch)
    • Reconciliation
      • Get Reconciliation Order List By Page
    • Crypto Payment Link
      • Abnormal fund
        • Abnormal funds
        • Matchable Payment links
        • Link Order(Abnormal fund)
        • Submit to platform
      • Create Payment Link
      • List Payment links
      • Get Curreny Network Config
    • External Provider
      • FE: Create stablecoin collection sub-account link
      • Create stablecoin collection sub-account link
        POST
      • Get sub wallet account
        GET
      • List sub wallet accounts
        GET
      • Change sub wallet status
        POST
      • Query stablecoin collection order list
        GET
      • Query stablecoin collection order status
        GET
      • Get quote
        GET
      • Accept stablecoin collection order
        POST
      • Reject stablecoin collection order
        POST
      • Query USD balance
        GET
      • USD Payout (withdrawal)
        POST
      • Query USD Payout order status
        GET
      • Query USD Payout order list
        GET
    • Mock
      • Mock Virtual account Payin Order
      • Mock wallet deposit transaction
      • Mock Payin Order Refund
      • Mock Payout Order Update Status
    • Pay Session
      • Request Pay Session
  • Webhooks & Events
    • Resend Fail Webhook
    • Open Virtual Account Status
    • Virtual Account Payment Status
    • Virtual Account Invoice update
    • Transaction Status Notification
    • KYB Status Notification
    • Deposit Sender Detail Required
    • Abnormal Fund Notification
    • WALLET_TRANSFER_ORDER_UPDATED
    • Sub Virtual Account RFI Required
    • Sub Wallet Update
    • wallet address whitelist Copy
    • Crypto Deposit Order Notification
    • Collect Order Updated
    • Usd Payout Order Updated
  • Appendix
    • Enum
    • Virtual Account(VA) Support List & KYB requirement
  • Release Notes & Changelog
    • Version History
  • Schemas
    • walletBalance
    • walletAddress
    • transactionRecord
  1. External Provider

FE: Create stablecoin collection sub-account link

Merchant Collect iframe integration#

1. Embedding#

Load the collect page URL returned by the server inside an iframe.

1.1 iframe permissions: allow (do not use allow-same-origin)#

The collect page may be embedded by other sites in an iframe (cross-origin). The parent page only needs to set:
AttributeDescription
allow="clipboard-write"Allows clipboard write inside the iframe (e.g. Copy Link); otherwise the browser may block copy.
Do not set allow-same-origin in sandbox: otherwise the iframe would be treated as same-origin with the embedder, allowing our page to access the embedder’s document and creating a security risk. Without sandbox, the iframe loads under our domain normally; cookies, storage, and canvas export/download work; the parent only needs to grant clipboard via allow="clipboard-write".

2. Close event: postMessage contract#

When the user clicks the close button inside the collect page, the iframe sends a postMessage to the parent window so the parent can hide the iframe, close a modal, or run other logic.

2.1 Message payload#

FieldTypeDescription
typestringAlways 'MERCHANT_COLLECT_CLOSED'; use this to identify the close event.
sourcestringAlways 'merchant-collect'; identifies the sending page.
Example:
{
  "type": "MERCHANT_COLLECT_CLOSED",
  "source": "merchant-collect"
}

2.2 When the message is sent#

Sent only when the page is inside an iframe (i.e. window.parent !== window).
Sent to window.parent; targetOrigin is determined by env or default.

3. Parent page: how to listen#

3.1 Plain JavaScript#

3.2 Validate origin (recommended)#

Validate event.origin and only accept messages from trusted origins:

4. URL parameter: darkMode (optional)#

The collect page accepts a URL query parameter darkMode to override the user’s local/persisted theme so the parent and embed can match.
ParameterValuesEffect
darkModetrue / 1 / yesForce dark
darkModefalse / 0 / noForce light
If omitted or invalid, the current theme is unchanged (local or system preference).
When setting the iframe src, the parent can append this parameter to the server-returned collect URL, e.g.:
https://example.com/en/merchant-collect?token=xxx&darkMode=true

5. Set dark mode via postMessage (overrides URL)#

The parent can send a postMessage to the collect iframe to switch dark/light mode at runtime. This overrides the URL darkMode parameter (e.g. load with URL light, then switch to dark via postMessage).

5.1 Message format (parent → iframe)#

FieldTypeDescription
typestringMust be 'MERCHANT_COLLECT_SET_DARK_MODE'.
darkModebooleantrue = dark, false = light.

5.2 How to send#

Get the iframe’s contentWindow and call postMessage with the collect page’s origin as the second argument (use window.location.origin when same-origin):
The message is only handled when the collect page is inside an iframe; the theme set by postMessage overrides the current URL darkMode parameter.
Previous
Get Curreny Network Config
Next
Create stablecoin collection sub-account link
Built with