Developer Documentation
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
| Parameter | Value |
|---|
Obtain an access token using your merchant credentials via OpenID Connect:
Create a payment session with the desired amount, currency, and providers:
Send the customer to the payment page with the session ID:
After payment, the customer is redirected to the successUrl or errorUrl you provided in Step 2.
If you want to embed the payment widget directly in your page instead of redirecting:
| Callback | Parameters | Returns | Description |
|---|---|---|---|
| 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 |
| Option | Type | Default | Description |
|---|---|---|---|
| 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 |
Test a payment in the sandbox environment: