Boxo Payments is an integrated in-app payment solution that enables users of host apps to securely make payments for orders directly within a miniapp. By leveraging the Boxo platform, it simplifies the payment process, allowing users to complete transactions seamlessly without leaving the host app environment. This functionality ensures a smooth and secure payment experience for users, while providing miniapp developers with an easy-to-integrate solution for handling payments within their services.
Here is diagram showcasing the payment of miniapp’s order with the host app’s payment system
Here is the streamlined process for handling payment in a Boxo Miniapp:
User reaches the payment page in the Miniapp and proceeds to create an order.
Miniapp server creates the order and sends a createOrderPayment
request to the Boxo Platform.
Boxo Platform initiates the payment request on the Host app server.
Host app server returns the orderPaymentID
to the Boxo Platform.
Boxo Platform returns the orderPaymentID
to the Miniapp server.
Miniapp server sends the orderPaymentID
to the Miniapp.
The Miniapp passes the orderPaymentID
to the Boxo JS SDK pay
method.
The Boxo Native SDK listens for the pay
event triggered by the Boxo JS SDK and displays the payment confirmation page to the user.
User confirms the payment on the payment confirmation page.
The Host app handles the payment and sends the payment status back to the Boxo JS SDK pay
event.
The Miniapp handles the payment status event from the Boxo JS SDK and updates the order payment status in the Miniapp server.
Miniapp confirms the order payment status.
Finally, the Miniapp shows the order payment status page to the user.
Note: Feature must be enabled in Dashboard Partnership
Data format Currently, the Boxo platform uses JSON format for data exchange. When working with decimals, they are represented as either float, number, or string, with a maximum of 20 digits and 2 digits after the decimal point. Additionally, the data type definitions include limits on the size of strings, ensuring consistent and manageable data structures across systems.
This endpoint is on Boxo platform. Send request to create order payment (see step 2 in diagram).
URL and METHOD:
This is HTTPS POST /api/v1/orders/create-order-payment/
endpoint
IP address of requesting services must be provided in Dashboard for whitelisting or Request Signaturing must be enabled
Headers
Key | Value |
---|---|
Content-type | application/json |
Body:
Field | Data type | Optional | Description |
---|---|---|---|
app_id | String | Miniapp identifier | |
client_id | String | Hostapp identifier | |
order | OrderDetails | Order info (amount, currency and etc.) |
Here is the data for OrderDetails, OrderItem, and OrderShippingAddress in a clean, well-structured format:
OrderDetails
Field | Data Type | Optional | Description |
---|---|---|---|
currency | String(20) | No | Order amount currency |
amount | Decimal | No | Order amount |
subtotal_amount | Decimal | Yes | Subtotal amount of the order |
shipping_amount | Decimal | Yes | Shipping cost |
discount_amount | Decimal | Yes | Discount applied on the order |
tax_title | String(250) | Yes | Title of the tax applied |
tax_amount | Decimal | Yes | Tax amount |
taxes_included | Bool | Yes | Indicates whether taxes are included |
note | String | Yes | Additional notes for the order |
miniapp_order_id | String(250) | Yes | Order reference in the miniapp |
hostapp_user_id | String(250) | Yes | User reference in the host app |
items | OrderItem[] | Yes | List of items purchased in the order |
shipping_address | OrderShippingAddress | Yes | Shipping address information |
custom_attributes | JSON | Yes | Custom attributes for the order |
OrderItem
Field | Data Type | Optional | Description |
---|---|---|---|
product_name | String(250) | Yes | Name of the product |
product_variant_name | String(250) | Yes | Name of the product variant |
product_sku | String(250) | Yes | Product SKU |
product_image_url | String(250) | Yes | URL of the product image |
quantity | Integer | Yes | Quantity of the product in the order |
price | Decimal | Yes | Price of the product |
discount | Decimal | Yes | Discount applied to the product |
OrderShippingAddress
Field | Data Type | Optional | Description |
---|---|---|---|
address1 | String(1000) | Yes | Address line 1 |
address2 | String(1000) | Yes | Address line 2 |
first_name | String(250) | Yes | First name of the recipient |
last_name | String(250) | Yes | Last name of the recipient |
phone | String(250) | Yes | Phone number of the recipient |
region_name | String(100) | Yes | Name of the region or state |
region_code | String(100) | Yes | Code of the region or state |
province_name | String(250) | Yes | Name of the province |
province_code | String(250) | Yes | Code of the province |
city | String(250) | Yes | City of the recipient |
country | String(250) | Yes | Country of the recipient |
postal_code | String(250) | Yes | Postal code of the recipient |
latitude | Decimal | Yes | Latitude of the shipping address (up to 15 digits after the decimal) |
longitude | Decimal | Yes | Longitude of the shipping address (up to 15 digits after the decimal) |
Decimal Limits for Coordinates:
Response:
Response status will be 400
in case there is error_code
Response body:
Field | Data type | Optional | Description |
---|---|---|---|
order_payment_id | String(250) | Yes | Order payment identifier |
error_code | String | Yes | If some error is occured error code should be provided. Example: {"error_code": "INVALID_ORDER_DATA"} All error codes can be found here |
Request Example:
Response Example:
This endpoint is on Boxo platform. Send request to get order payment status (see “Check order status” step in diagram).
URL and METHOD:
This is HTTPS POST /api/v1/orders/get-payment-status/
endpoint
IP address of requesting services must be provided in Dashboard for whitelisting or Request Signaturing must be enabled
Headers:
Key | Value |
---|---|
Content-type | application/json |
Body:
Field | Data type | Optional | Description |
---|---|---|---|
app_id | String | Miniapp identifier | |
client_id | String | Hostapp identifier | |
order_payment_id | String(250) | Order payment identifier |
Response:
Response status will be
400
in case there is error_code
Response body:
Field | Data type | Optional | Description |
---|---|---|---|
order_payment_id | String | Yes, in case error_code passed | Order payment identifier |
app_id | String | Yes | Miniapp identifier |
client_id | String | Yes | Hostapp identifier |
payment_status | String | Yes | Order payment status: in_process| paid| cancelled |failed |
payment_fail_reason | String | Yes | Order payment fail reason |
error_code | String | Yes | Error code. Example: {"error_code": "ORDER_NOT_FOUND"} All error codes can be found here |
Request Example
Setup this endpoint for Boxo platform to complete order payment(see step after 10 in diagram).
URL and METHOD: This endpoint must handle a HTTPS POST request URL to endpoint must be provided in Dashboard
Headers:
Key | Value |
---|---|
Authorization | Basic <base64 encoded(app_id:secret_key)> |
Content-type | application/json |
app_id
and secret_key
will be provided in Dashboard
Body:
Field | Data type | Description |
---|---|---|
miniapp_order_id | String(250) | Miniapp order indentifier |
hostapp_order_payment_id | String(250) | Order payment identifier |
hostapp_client_id | String(250) | Hostapp identifier |
payment_status | String | Order payment status: in_process| paid| cancelled| failed |
payment_fail_reason | String | Order payment fail reason |
Response:
Response status must be
200
in all cases
Response body:
Field | Data type | Description |
---|---|---|
code | String | Request result code example: SUCCESS |
error_code | String | Error code |
Request Example:
Response Example:
When the order is created payment should be handled on host app’s side. Use appboxoSdk.pay
method as in example to open payment pages on host app.
Boxo Payments is an integrated in-app payment solution that enables users of host apps to securely make payments for orders directly within a miniapp. By leveraging the Boxo platform, it simplifies the payment process, allowing users to complete transactions seamlessly without leaving the host app environment. This functionality ensures a smooth and secure payment experience for users, while providing miniapp developers with an easy-to-integrate solution for handling payments within their services.
Here is diagram showcasing the payment of miniapp’s order with the host app’s payment system
Here is the streamlined process for handling payment in a Boxo Miniapp:
User reaches the payment page in the Miniapp and proceeds to create an order.
Miniapp server creates the order and sends a createOrderPayment
request to the Boxo Platform.
Boxo Platform initiates the payment request on the Host app server.
Host app server returns the orderPaymentID
to the Boxo Platform.
Boxo Platform returns the orderPaymentID
to the Miniapp server.
Miniapp server sends the orderPaymentID
to the Miniapp.
The Miniapp passes the orderPaymentID
to the Boxo JS SDK pay
method.
The Boxo Native SDK listens for the pay
event triggered by the Boxo JS SDK and displays the payment confirmation page to the user.
User confirms the payment on the payment confirmation page.
The Host app handles the payment and sends the payment status back to the Boxo JS SDK pay
event.
The Miniapp handles the payment status event from the Boxo JS SDK and updates the order payment status in the Miniapp server.
Miniapp confirms the order payment status.
Finally, the Miniapp shows the order payment status page to the user.
Note: Feature must be enabled in Dashboard Partnership
Data format Currently, the Boxo platform uses JSON format for data exchange. When working with decimals, they are represented as either float, number, or string, with a maximum of 20 digits and 2 digits after the decimal point. Additionally, the data type definitions include limits on the size of strings, ensuring consistent and manageable data structures across systems.
This endpoint is on Boxo platform. Send request to create order payment (see step 2 in diagram).
URL and METHOD:
This is HTTPS POST /api/v1/orders/create-order-payment/
endpoint
IP address of requesting services must be provided in Dashboard for whitelisting or Request Signaturing must be enabled
Headers
Key | Value |
---|---|
Content-type | application/json |
Body:
Field | Data type | Optional | Description |
---|---|---|---|
app_id | String | Miniapp identifier | |
client_id | String | Hostapp identifier | |
order | OrderDetails | Order info (amount, currency and etc.) |
Here is the data for OrderDetails, OrderItem, and OrderShippingAddress in a clean, well-structured format:
OrderDetails
Field | Data Type | Optional | Description |
---|---|---|---|
currency | String(20) | No | Order amount currency |
amount | Decimal | No | Order amount |
subtotal_amount | Decimal | Yes | Subtotal amount of the order |
shipping_amount | Decimal | Yes | Shipping cost |
discount_amount | Decimal | Yes | Discount applied on the order |
tax_title | String(250) | Yes | Title of the tax applied |
tax_amount | Decimal | Yes | Tax amount |
taxes_included | Bool | Yes | Indicates whether taxes are included |
note | String | Yes | Additional notes for the order |
miniapp_order_id | String(250) | Yes | Order reference in the miniapp |
hostapp_user_id | String(250) | Yes | User reference in the host app |
items | OrderItem[] | Yes | List of items purchased in the order |
shipping_address | OrderShippingAddress | Yes | Shipping address information |
custom_attributes | JSON | Yes | Custom attributes for the order |
OrderItem
Field | Data Type | Optional | Description |
---|---|---|---|
product_name | String(250) | Yes | Name of the product |
product_variant_name | String(250) | Yes | Name of the product variant |
product_sku | String(250) | Yes | Product SKU |
product_image_url | String(250) | Yes | URL of the product image |
quantity | Integer | Yes | Quantity of the product in the order |
price | Decimal | Yes | Price of the product |
discount | Decimal | Yes | Discount applied to the product |
OrderShippingAddress
Field | Data Type | Optional | Description |
---|---|---|---|
address1 | String(1000) | Yes | Address line 1 |
address2 | String(1000) | Yes | Address line 2 |
first_name | String(250) | Yes | First name of the recipient |
last_name | String(250) | Yes | Last name of the recipient |
phone | String(250) | Yes | Phone number of the recipient |
region_name | String(100) | Yes | Name of the region or state |
region_code | String(100) | Yes | Code of the region or state |
province_name | String(250) | Yes | Name of the province |
province_code | String(250) | Yes | Code of the province |
city | String(250) | Yes | City of the recipient |
country | String(250) | Yes | Country of the recipient |
postal_code | String(250) | Yes | Postal code of the recipient |
latitude | Decimal | Yes | Latitude of the shipping address (up to 15 digits after the decimal) |
longitude | Decimal | Yes | Longitude of the shipping address (up to 15 digits after the decimal) |
Decimal Limits for Coordinates:
Response:
Response status will be 400
in case there is error_code
Response body:
Field | Data type | Optional | Description |
---|---|---|---|
order_payment_id | String(250) | Yes | Order payment identifier |
error_code | String | Yes | If some error is occured error code should be provided. Example: {"error_code": "INVALID_ORDER_DATA"} All error codes can be found here |
Request Example:
Response Example:
This endpoint is on Boxo platform. Send request to get order payment status (see “Check order status” step in diagram).
URL and METHOD:
This is HTTPS POST /api/v1/orders/get-payment-status/
endpoint
IP address of requesting services must be provided in Dashboard for whitelisting or Request Signaturing must be enabled
Headers:
Key | Value |
---|---|
Content-type | application/json |
Body:
Field | Data type | Optional | Description |
---|---|---|---|
app_id | String | Miniapp identifier | |
client_id | String | Hostapp identifier | |
order_payment_id | String(250) | Order payment identifier |
Response:
Response status will be
400
in case there is error_code
Response body:
Field | Data type | Optional | Description |
---|---|---|---|
order_payment_id | String | Yes, in case error_code passed | Order payment identifier |
app_id | String | Yes | Miniapp identifier |
client_id | String | Yes | Hostapp identifier |
payment_status | String | Yes | Order payment status: in_process| paid| cancelled |failed |
payment_fail_reason | String | Yes | Order payment fail reason |
error_code | String | Yes | Error code. Example: {"error_code": "ORDER_NOT_FOUND"} All error codes can be found here |
Request Example
Setup this endpoint for Boxo platform to complete order payment(see step after 10 in diagram).
URL and METHOD: This endpoint must handle a HTTPS POST request URL to endpoint must be provided in Dashboard
Headers:
Key | Value |
---|---|
Authorization | Basic <base64 encoded(app_id:secret_key)> |
Content-type | application/json |
app_id
and secret_key
will be provided in Dashboard
Body:
Field | Data type | Description |
---|---|---|
miniapp_order_id | String(250) | Miniapp order indentifier |
hostapp_order_payment_id | String(250) | Order payment identifier |
hostapp_client_id | String(250) | Hostapp identifier |
payment_status | String | Order payment status: in_process| paid| cancelled| failed |
payment_fail_reason | String | Order payment fail reason |
Response:
Response status must be
200
in all cases
Response body:
Field | Data type | Description |
---|---|---|
code | String | Request result code example: SUCCESS |
error_code | String | Error code |
Request Example:
Response Example:
When the order is created payment should be handled on host app’s side. Use appboxoSdk.pay
method as in example to open payment pages on host app.