Cube integreation
Express UI made checkout for delivery and paymet
Cube SDK Payload Data Structure
The Cube SDK provides flexibility in managing both payments and delivery services. Below is a detailed breakdown of the payload data structure required when integrating the Cube SDK into your application.
Payload Structure Overview
The payload is a JavaScript object passed to the CubeSDK.config()
method, containing essential details about the transaction, customer, and delivery.
Detailed Breakdown
- public_key (String)
This is your Public API Key provided by Mervii. You should replace this with your live or test API key when configuring the SDK.
- amount (Number)
The total amount to be charged for the transaction. This should include all costs, such as delivery fees, if applicable.
- currency (String)
The currency in which the transaction will be processed. In this case, NGN is used for Nigerian Naira.
- country (String)
The country code where the transaction is being processed. Here, NG refers to Nigeria.
- payment_options (Array of Strings)
A list of available payment methods. The current supported options include USSD and Transfer.
- customer (Object)
Contains customer details required for the transaction.
name: Full name of the customer.
phone_number: Primary contact phone number.
email: Customer’s email address.
- merchant_details (Object)
Details about the merchant processing the payment.
title: The name of the merchant or business.
description: A short description of the transaction or product.
logo: A URL pointing to the merchant’s logo.
- handle_delivery (Boolean)
Set to true if the SDK should handle delivery processing for the transaction.
- charge_delivery (Boolean)
Set to true if delivery charges should be applied to the transaction.
-item_weight (Number)
The total weight of the item(s) for delivery, in kilograms.
- delivery_items (Array)
A list of items being delivered. This array can be left empty if there are no specific items to track.
- pickup_location (Object)
Details about the pickup location for the delivery.
region: Coordinates (latitude and longitude) of the pickup location.
city: The city where the pickup is taking place.
state_code: The code of the state where the pickup is located.
country_code: The code of the country where the pickup is located.
contacts: Information about the contact person at the pickup location.
- redirect_url (String)
A URL to which the user will be redirected after the transaction is complete. This can be left empty if no redirection is required.
Event Handlers
The event handler give you the real-time notification
- onCancel(data):
Callback for when the payment is cancelled by the user.
- onSuccess(transaction):
Callback for a successful payment transaction.
- onFailed(transaction):
Callback for a failed payment attempt.
- onError(error):
Callback for handling errors during the transaction process.
Example Payload
Here’s a full example of the payload structure
Was this page helpful?