Fiat Currency Payment
# Request URL
- POST https://test2-openapi.91fafafa.com/api/payment/india/order/create/v1
# Request parameters
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
appId | string | Y | Merchant AppId | B2iwKFIM4tvo |
merchantId | string | Y | Merchant id | CH10001165 |
mchOrderNo | string | Y | Merchant order number(Length is limited to 32 digits) | C202401090030 |
paymentMode | string | Y | Payment method P2P;LOCAL_PAY | LOCAL_PAY |
amount | string | Y | Amount | 800 |
name | string | N | Customer name | CheezeePayTest |
phone | string | N | Customer phone | 9123456789 |
string | Y | Email or User ID The value of this field can be passed to the email or user ID (the maximum length cannot exceed 128 characters) The more realistic the entry, the higher the success rate, The lower the risk control coefficient is triggered, Note: If using a P2P channel, please comply with each user's fixed ID or email address, otherwise the channel will be closed. | [email protected] | |
notifyUrl | string | Y | Notification callback URL | https://yourdomain/notifyUrl |
returnUrl | string | N | Checkout page redirection URL | https://yourdomain/returnUrl |
language | string | Y | Checkout page language For paymentMode equal to LOCAL_PAY supports en-English. For paymentMode equal to P2P, supports zh_hk-Chinese; en-English; indonesia-Indonesian. | en |
timestamp | long | Y | Submission time (Timestamp: Milliseconds) | 1704167614000 |
sign | string | Y | Signature | Oh//nfi9gWOjFLC7POWMut7qXL RQSXtX1CWjtQAlxjhDZSglwX5c RxRUYglC6ToA9/wtbrwHqW0Mfx xMiY+d0A3vm16oxEPpkwLyw/76 OaqhBU7YKVsHf+GUsnS9OND05M yoH2E9wWAb+FDooYyht68Vu2ll OUcuUNfP+sQFPeFxzDgWyVchGU nMZPM/DPHP9JjttJvLcrPArkPR RpNJk3Fca+Nd2x5eE1jwFn5n77 dJFOZPrKXKJ/+gFj/QN6NVTvDa EyCOXFqEvo46613Uc0BR2bIbDT KRxvEi9Of8RRQujTkI7E5rPaXx kzVIRdOxpWnr2V7f0R2GqnUNDV XtQ== |
# Example of request message
{
"appId": "B2iwKFIM4tvo",
"merchantId": "CH10001165",
"mchOrderNo": "C202401090030",
"paymentMode": "LOCAL_PAY",
"amount": "800",
"name": "CheezeePayTest",
"phone": "9123456789",
"email": "[email protected]",
"notifyUrl": "https://yourdomain/notifyUrl",
"returnUrl": "https://yourdomain/returnUrl",
"language": "en",
"timestamp": 1704167614000,
"sign": "Oh//nfi9gWOjFLC7POWMut7qXLRQSXtX1CWjtQAlxjhDZSglwX5cRxRUYglC6ToA9/wtbrwHqW0MfxxMiY+d0A3vm16oxEPpkwLyw/76OaqhBU7YKVsHf+GUsnS9OND05MyoH2E9wWAb+FDooYyht68Vu2llOUcuUNfP+sQFPeFxzDgWyVchGUnMZPM/DPHP9JjttJvLcrPArkPRRpNJk3Fca+Nd2x5eE1jwFn5n77dJFOZPrKXKJ/+gFj/QN6NVTvDaEyCOXFqEvo46613Uc0BR2bIbDTKRxvEi9Of8RRQujTkI7E5rPaXxkzVIRdOxpWnr2V7f0R2GqnUNDVXtQ=="
}
# Response parameters
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
code | String | Y | Response Code 000000 indicates success, others indicate failure. | 000000 |
msg | String | Y | Response Description success: Successful | success |
tradeNo | String | Y | Platform Order Number | 1746094916709126144 |
cashierLink | String | Y | Cashier's Link | https://c13.onepyg.top/pays? ord=QKP2401131700439860190 &amt=800.00&pway=900&ptype=1 |
sign | String | Y | Signature | GfpNwHrHeTYnidB9bHgdT gvsnbN8GIoo1NgYHmBpNi ucCSAKdjSKRnPs8bcnP/R cQZ8RZPuvh8ayBRBZOtgJ o4pxG89hT7MaXGUAhjMU+ gkns6EvN+RsNF+WKuqyWD rhXYVCZzDud7sKFeEqmyC SFNsViuBPCG5660z+euTi 35Q5O0J046FlMJi0+fn1f Cb+mHgauq7jkyuzXtAkRg IW1gKxa9YoBUYxdV26izI W4bgnCLF3b2w8ksXbs6F7 Bu7PjPGHRvZK9SjrrrYOm mIfCt8cwQFyaY3cWAuD8M /3yl5+iSQQxD9rN+Y/Bdm ps4v8zdTuniHy3gIzn2t8 o9saFQ== |
# Successful response message example
- Order successful response message example
{
"code": "000000",
"msg": "success",
"tradeNo": "1746094916709126144",
"cashierLink": "https://c13.onepyg.top/pays?ord=QKP2401131700439860190&amt=800.00&pway=900&ptype=1",
"sign": "GfpNwHrHeTYnidB9bHgdTgvsnbN8GIoo1NgYHmBpNiucCSAKdjSKRnPs8bcnP/RcQZ8RZPuvh8ayBRBZOtgJo4pxG89hT7MaXGUAhjMU+gkns6EvN+RsNF+WKuqyWDrhXYVCZzDud7sKFeEqmyCSFNsViuBPCG5660z+euTi35Q5O0J046FlMJi0+fn1fCb+mHgauq7jkyuzXtAkRgIW1gKxa9YoBUYxdV26izIW4bgnCLF3b2w8ksXbs6F7Bu7PjPGHRvZK9SjrrrYOmmIfCt8cwQFyaY3cWAuD8M/3yl5+iSQQxD9rN+Y/Bdmps4v8zdTuniHy3gIzn2t8o9saFQ=="
}
- Order failed response message example
{
"code": "A0500",
"msg": "Request service exception (A0500)"
}
# Code implementation demo
- Code examples are for reference only, please refer to the request parameter description for specific parameters.
package com.cheesepay;
import com.google.gson.Gson;
import com.cheesepay.CheeseTradeRSAUtil;
import okhttp3.*;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.Map;
public class PaymentDemo {
// Platform public key
private static final String PLAT_PUBLIC_KEY ="MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA1dad35S74jfLPbHJh8P0jDHiTvkxwrtITK97ovVu19B24UdiHyHoEZgtNlS6alFQj1ULQ71d6EPh2rWCNkS2b5HGQXwDYBtwvesVQ8h4Sf3eVPTTLGw3BS7Os4vtDEN6BezMdv3sUG2N5i6JF+5H4CQTq3MD2Cx6u/Cv7oFOdFqeDT0AH+TR7uyZxn69OtkJaHHr834EUcdShJKKMQtbC11WCcut7ilDUgdvZnThiVTq7cfl8mcC9FDKcQ9bMWamScWIB5cJQdUW23Kr0c1NvZlpgPS8U5VODM4Uc4muHJPD2cJmquuJ+4AGP36rEk27lUB3h7B6JI1QGiuh1yyPDwIDAQAB";
// Merchant's private key
private static final String MCH_PRIVATE_K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r07OXO85QKBgCkXdN6Nh9+aTP0jla+7yrK8cnolTc0G4rl5iKHQdInFyz2Ux3DDBDJAUrcsxE3FCWFP80mY01tag1A7SrGnNpfOAnWhZMirQbBwn/AT67WpRfkBu2mEmp8qhYNn6B7j0Nol5FrATMf9NViWVZB5skehOAik7klZcULiXy9ayYdFAoGAA+0bLim5gYZpZdh6nIz8ro9UAYeMdWsFAWv0VKdoJtNEclcC1ZY+5elNSNGcfn63qQBRDlisrhnPCrqiAQJwmZM1HOl3tgf7lKEE1wTZF4ZOguIcdTMQOvVd+dCRkqC07CXRToKT5qq9bb98lLqaBjxikqMMZ0PlzBIgzijckc0CgYAH16CziStEZVvKbiR8b0ftF9mf6V8I0KHianMgV8X6Y51aE0Ig1eQhIvqSjqtBac7gEppiu3OQVrp39uLdgyvDSVta1Hq9QYYTDNt8crt69aD/Th1h5esYvApYyZIhHbFDR5meE4Y3nHpfY7J8zhmfyaVW/6cuwPaToTtrEjQmWQ==";
// Payment interface URL
private static final String apiUrl = "https://test2-openapi.91fafafa.com/api/payment/india/order/create/v1";
// Callback URL
private static final String cashNotify = "https://yourdomain/notifyUrl";
private static final String cashUrl = "https://yourdomain/returnUrl";
public static void main(String[] args) throws Exception {
payment();
}
private static void payment() throws Exception {
Map<String, Object> requestParams = new HashMap<>();
requestParams.put("appId", "B2iwKFIM4tvo");
requestParams.put("merchantId", "CH10001165");
// Order number cannot be duplicated
requestParams.put("mchOrderNo", "C202401090030");
requestParams.put("paymentMode", "LOCAL_PAY");
requestParams.put("amount", "800");
requestParams.put("name", "CheezeePayTest");
requestParams.put("phone", "9123456789");
requestParams.put("email", "[email protected]");
requestParams.put("notifyUrl", cashNotify);
requestParams.put("returnUrl", cashUrl);
requestParams.put("language", "en");
requestParams.put("timestamp", "1704167614000");
// Private key encryption
String platSign = CheeseTradeRSAUtil.getSign(requestParams, MCH_PRIVATE_KEY);
requestParams.put("sign", platSign);
// Interface request
Gson gson = new Gson();
String requestBody = gson.toJson(requestParams);
System.out.println("Post Json Params:" + requestBody);
// Send a request and get a response
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json; charset=utf-8");
RequestBody body = RequestBody.create(mediaType, requestBody);
Request request = new Request.Builder()
.url(apiUrl)
.post(body)
.addHeader("User-Agent", "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.63 Safari/537.36")
.build();
Response response = client.newCall(request).execute();
if (!response.isSuccessful()) {
// Failure handling...
System.out.println("Request failed: " + response.code() + " - " + response.message());
}
// Signature verification processing
String responseBody = response.body().string();
System.out.println("Response: " + responseBody);
Type type = new com.google.gson.reflect.TypeToken<Map<String, Object>>() {}.getType();
Map<String, Object> map = gson.fromJson(responseBody, type);
boolean verifyResult = CheeseTradeRSAUtil.verifySign(map, PLAT_PUBLIC_KEY);
if (verifyResult) {
// ... If signature verification is successful, process normal business logic.
} else {
// ... Signature verification error
}
response.close();
}
}