B1M — Payment SDK

Developer Documentation

Quick Start

Add the SDK to your payment page via CDN:

<!-- Add to your HTML <head> -->
<script src="https://unpkg.com/@epheliagroup/pay-with-b1m/dist/pay-with-b1m.dist.js"></script>
<link href="https://unpkg.com/@epheliagroup/pay-with-b1m/dist/pay-with-b1m.dist.css" rel="stylesheet" />

Or install via npm:

npm install @epheliagroup/pay-with-b1m

Environments

ParameterValue

Integration Guide

Step 1: Authenticate (server-side)

Obtain an access token using your merchant credentials via OpenID Connect:


          

Step 2: Create a payment session (server-side)

Create a payment session with the desired amount, currency, and providers:


          
Available providers: B1M (in-app payment), CARD_REGISTRATION (card + quick registration), STRIPE (card-only, no registration).

Step 3: Redirect the customer

Send the customer to the payment page with the session ID:


          

Step 4: Handle the result

After payment, the customer is redirected to the successUrl or errorUrl you provided in Step 2.

SDK Widget Reference

If you want to embed the payment widget directly in your page instead of redirecting:


          

Callback Reference

CallbackParametersReturnsDescription
createPaymentSession { amount, currency, reason, providers } { paymentSessionId, status, amount, currency, ... } Creates a new payment session on your server
fetchPaymentDataBySessionId paymentSessionId { paymentSessionId, status, amount, currency, merchantDisplayName, providers, ... } Retrieves payment session data
initiatePayment { paymentSessionId, provider } { amount, currency, status, clientSecret, otp, ... } Initiates payment with the selected provider
updatePayment paymentSessionId, status Response Updates the payment status
approveCardPayment paymentSessionId Response Confirms a Stripe card payment
quickRegisterCustomer { email, currency, firstName, lastName, prefix, mobileNumber, birthDate, paymentSessionId } { walletId, partyId } Registers a new customer during card payment flow

Render Options

OptionTypeDefaultDescription
renderPayWithToonieButton boolean true Show the "Pay with B1M" button
renderStreamWithToonieButton boolean true Show the streaming payment button
renderPayWithCardButton boolean true Show the card payment button
baseUrl string API base URL for the environment

Playground

Test a payment in the sandbox environment: