POSaBIT PAY (B2B) Integration Guide
POSaBIT PAY (B2B) Integration Guide
Overview
This document outlines the integration process for third-party developers and B2B platforms to connect with the POSaBIT PAY system using JavaScript and RESTful APIs. Integration includes initializing the POSaBIT PAY SDK, generating and submitting payment requests, and managing payment lifecycle events such as refunds and adjustments.
1. SDK Integration
JavaScript SDK URLs
Include the correct environment SDK on your checkout or payment page:
- Test:
https://coretestapi.posabit.com/ThirdParty/scripts/client/sdk-1.0.min.js
- Stage:
https://corestageapi.posabit.com/api/ThirdParty/scripts/client/sdk-1.0.min.js
- Production:
https://coreapi.posabit.com/ThirdParty/scripts/client/sdk-1.0.min.js
Initialization
Hypur.SDK.init({ apiVersion: "1.0", clientPubKey: "<YOUR_PUBLIC_KEY>", clientName: "Your Business Name", debug: false, environment: "PRO", // Options: TEST, STG, PRO products: ["Payments"], onClose: () => console.log("Hypur App Closed"), onOpen: () => console.log("Hypur App Opened"), onInit: () => console.log("Hypur Initialized"), onSuccess: () => console.log("Hypur Payment Success") });
2. Payment Flow
- Test:
https://coretestapi.posabit.com/thirdparty/payments/v[apiVersion]/[method]
- Stage:
https://corestageapi.posabit.com/thirdparty/payments/v[apiVersion]/[method]
- Production:
https://coreapi.posabit.com/thirdparty/payments/v[apiVersion]/[method]
Step 1: Create Request (Backend API)
POST /thirdparty/payments/v1.0/CreateRequest
Headers: Authorization: Basic <Base64(ClientId:ClientSecret)>
Body:
{ "Amount": 150.00, "ApiVersion": "1.0", "ClientPubKey": "<YourPublicKey>", "UserBusinessAddress": "123 Main St", "UserBusinessCity": "Seattle", "UserBusinessName": "POSaBIT Dispensary", "UserBusinessStateCode": "WA", "UserBusinessZip": "98101", "UserEmail": "buyer@example.com", "UserFirstName": "John", "UserLastName": "Doe", "UserPhone": "1234567890" }
Success Response:
{ "Success": true, "Payload": "RequestUid123", "Message": "" }
Step 2: Open The POSaBIT Pay App
Hypur.Payments.open("RequestUid123");
3. Submit Payment Request
POST /thirdparty/payments/v1.0/SubmitRequest
Body:
{ "RequestUid": "RequestUid123", "OrderNumber": "PO123456", "OrderDescription": "Wholesale Flower Order", "Amount": 150.00, "PayDate": "2025-07-01" }
4. Manage Transactions
Refund Request
POST /thirdparty/payments/v1.0/RefundRequest
{ "RequestUid": "RequestUid123", "Reason": "Order Canceled" }
Adjust Request
POST /thirdparty/payments/v1.0/AdjustRequest
{ "RequestUid": "RequestUid123", "Amount": 145.00, "PayDate": "2025-07-02", "OrderNumber": "PO123456-RevA", "OrderDescription": "Revised Flower Order", "Reason": "Price Adjustment" }
5. Optional: Addendum Request (for additional linked requests)
POST /thirdparty/payments/v1.0/AddendumRequest
{ "RequestUid": "RequestUid123", "Amount": 50.00 }
Response:
{ "Success": true, "Payload": "NewRequestUid456", "Message": "" }
You must call SubmitRequest
for the new NewRequestUid
.
6. Authorization & Security
- All API calls require Basic Auth using
Base64(ClientId:ClientSecret)
- Always use HTTPS endpoints
- Use different credentials and keys per environment (Test / Stage / Prod)
7. Developer Tips
- Handle
onSuccess
,onError
, andonClose
in the SDK to provide feedback to users. - Log
RequestUid
andOrderNumber
in your DB to support reconciliation. - Always check HTTP status codes (200 = Success, 400/401/404 = Error).
The Test page (only in Test)
https://coretest.posabit.com/thirdpartytester/payments
Below is a link to a video walking through the process of calling JavaScript (SDK)