Integrate Payment Gateway (Mainnet)
You need to follow these steps to create Order and payment using FRUITS Payment gateway
1. Login and set Merchant information
※If your merchant already has payment information, you don't need to perform this step.
2. Call the API as follows to get the orderId:
Headers: - API-KEY : After creating a merchant, contact the Fruits Organization to receive an api-key.
Method: POST
Request Body:
Required Parameter: (+) merchantId : merchant id (Please refer to "For Merchant" > "Basic Settings"). (+) total : FRTS total (+) product: your product name (+) successUrl: callback URL when payment is successful (+) cancelUrl: callback URL when user cancels Optional Parameter: (+) webhookUrl: callback URL when payment is confirmed (+) firstName: customer's first name (+) lastName: customer's last name (+) email: customer's email
Webhook: Method: POST Request body: (+) orderId: Order id. (+) status: Status of order.
Example:
HTTPS Request:
curl --location 'https://web-api.fruitspay.com/webapi/third-party/order' \
--header 'API-KEY: p_test_234SOCGHEyyN005ghJJJgCZqI5xY' \
--header 'Content-Type: application/json' \
--data '{
"merchantId":"so5rVDf1YBjN",
"total":"1",
"product":"product",
"successUrl":"https://google.com",
"cancelUrl":"https://google.com",
"firstName": "John",
"lastName": "Kevin",
"email": "[email protected]"
}'
Response:
(+) Successful case:
{
"code": 0,
"data": {
"orderId": "485357712222257152"
}
}
(+) In case of failure:
{
"code": 1,
"data": {
"errorCode": "",
"errorMessage": "message.exception.missingApiKey"
}
}
Webhook request body:
{
"orderId": "9347592739023747",
"status": "PAID"
}
3. Access below URL to confirm transaction:
After getting your order id, you need to access this url to enter to confirm screen: https://fruitspay.com/#/third-party/payment-checkout?orderId={orderId}

4. Select payment method and click "Complete checkout":
Depending on the payment method chosen, there will be 2 cases:
If you choose payment method is USD, you need to follow below instruction to complete payment.
If you choose other payment method, it will show QR code (using for wallet) and URL redirect to wallet. You need to follow below instruction to complete payment.
5. Check order status using the API as below:
If your need to check order status, please request to below API:
Method: GET
Example:
HTTPS Request:
curl --location 'https://web-api.fruitspay.com/webapi/third-party/get-order-detail/13943577969768333312'
Response:
(+) Successful case:
{
"firstName": null,
"lastName": null,
"email": null,
"address": null,
"status": "PAID",
"remainingCoinType": "ETH",
"createdTime": "2023-08-31T10:04:26.996566+07:00",
"listProduct": [
{
"productName": "product",
"price": null,
"quantity": 1,
"subTotal": 13000,
"subTotalFrts": 13000.000000000000000000
}
],
"total": 13000,
"totalTransactionCoin": 0.000919,
"successUrl": "url",
"cancelUrl": "url"
}
(+) In case of failure:
{
"code": 1,
"data": {
"errorCode": "",
"errorMessage": "message.exception.invalidOrderId"
}
}
Last updated