Fiat Currency Asynchronous Notification
# Asynchronous Notification of Collection
This interface is provided by the merchant. The platform requests this interface when the collection is successful When an HTTP request is received, please respond with httpcode=200 (HTTP Response Status Code). Otherwise, 16 notifications will be repeatedly sent within 5 hours.
⚠️⚠️Note: Users might only pay part of the amount, so it is necessary to check the 'actual payment amount'.⚠️⚠️
# Best Practice
- To determine successful payment, the orderStatus is 1.
- For partial payment determination: orderStatus is 3. Merchants should handle this according to their own business logic.
- On refund determination: orderStatus is 2. This situation generally occurs in case of customer complaints and bank risk control returns. Merchants should record related information and handle it according to their own business processes (a callback success will be received before getting this callback status).
- If the merchant's business logic fails to process, please change the HTTP response status code to 400 or 500 (non-200).
- Cheezeepay may send multiple callbacks with the same status. The merchant should handle this compatibility accordingly. If the merchant's own business has been processed successfully, they must return the HTTP response status code to 200.
- Please ensure to verify the callback IP➕signature verification.
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
merchantId | string | Y | Merchant ID | CH10001165 |
mchOrderNo | string | Y | Merchant Order Number | 20240123172337 |
platOrderNo | string | Y | Platform Order Number | 1749724564009521152 |
orderStatus | int | Y | Order Status | 1-Success 2-Refund 3-Partial Payment |
payAmount | string | Y | Order Actual Payment Amount | 800 |
amountCurrency | string | Y | Order Amount Currency | THB |
fee | string | Y | Handling Fee | 80 |
feeCurrency | string | Y | Handling Fee Currency | THB |
gmtEnd | long | Y | Completion Time (Timestamp: Milliseconds) | 1706003885000 |
sign | string | Y | Signature | FMZBnLfSfsWu1ZhHXBFifsexm9dGB5ZFt3RmVZ AkU9Ck1vE5tzMZGHkOon8mfqK8yhd9E7gQuiWX yqppWr6rlASviTinBEAjV5y3OqK0piA8bNyhGpR/W 4XPAaDKFyQ54IUbwypZwcBRJ9i5jKkTvOFh5YC+ TWFHkxfA0sK47xrixodVnHe+88hWSR3/oQdCMnN 4eGQN69IbpFILvC+PXQBfpuWTzHMPENuClm3nq 5mK/k7o5Nha9drHyJbPBO54t3Z+5L/aju7lfA9OgyV0 Ss1BHmhyugSx8gyMMSo1uDL1LYWWNmMgj8VO BUeHNSFPK3Cio7Ko0Bh1TreV7bCa1A== |
# Asynchronous Notification Message Example
{
"merchantId":"CH10001165",
"mchOrderNo":"20240123172337",
"platOrderNo":"1749724564009521152",
"orderStatus":1,
"payAmount":"800",
"amountCurrency":"THB",
"fee":"80",
"feeCurrency":"THB",
"gmtEnd":1706003885000,
"sign":"FMZBnLfSfsWu1ZhHXBFifsexm9dGB5ZFt3RmVZAkU9Ck1vE5tzMZGHkOon8mfqK8yhd9E7gQuiWXyqppWr6rlASviTinBEAjV5y3OqK0piA8bNyhGpR/W4XPAaDKFyQ54IUbwypZwcBRJ9i5jKkTvOFh5YC+TWFHkxfA0sK47xrixodVnHe+88hWSR3/oQdCMnN4eGQN69IbpFILvC+PXQBfpuWTzHMPENuClm3nq5mK/k7o5Nha9drHyJbPBO54t3Z+5L/aju7lfA9OgyV0Ss1BHmhyugSx8gyMMSo1uDL1LYWWNmMgj8VOBUeHNSFPK3Cio7Ko0Bh1TreV7bCa1A=="
}
# Asynchronous Notification Code Implementation Demo
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletResponse;
import java.util.Map;
@RestController
@RequestMapping("callback")
public class TestCallbackController {
/**
* Platform public key
*/
public static String PLATFORM_PUB_KEY = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA1dad35S74jfLPbHJh8P0jDHiTvkxwrtITK97ovVu19B24UdiHyHoEZgtNlS6alFQj1ULQ71d6EPh2rWCNkS2b5HGQXwDYBtwvesVQ8h4Sf3eVPTTLGw3BS7Os4vtDEN6BezMdv3sUG2N5i6JF+5H4CQTq3MD2Cx6u/Cv7oFOdFqeDT0AH+TR7uyZxn69OtkJaHHr834EUcdShJKKMQtbC11WCcut7ilDUgdvZnThiVTq7cfl8mcC9FDKcQ9bMWamScWIB5cJQdUW23Kr0c1NvZlpgPS8U5VODM4Uc4muHJPD2cJmquuJ+4AGP36rEk27lUB3h7B6JI1QGiuh1yyPDwIDAQAB";
/**
* payInCallback
* @param paramMap
* @param response
*/
@PostMapping("payIn")
public void payInCallback(@RequestBody Map<String, Object> paramMap, HttpServletResponse response) throws Exception{
boolean verifyResult = CheeseTradeRSAUtil.verifySign(paramMap, PLATFORM_PUB_KEY);
if (verifyResult) {
//Signature verification successful
//Order notification business processing logic
String merchantId = (String)paramMap.get("merchantId");
String mchOrderNo = (String)paramMap.get("mchOrderNo");
String platOrderNo = (String)paramMap.get("platOrderNo");
Integer orderStatus = (Integer)paramMap.get("orderStatus");
String payAmount = (String)paramMap.get("payAmount");
String amountCurrency = (String)paramMap.get("amountCurrency");
String fee = (String)paramMap.get("fee");
String feeCurrency = (String)paramMap.get("feeCurrency");
Long gmtEnd = (Long)paramMap.get("gmtEnd");
} else {
//Signature verification failed
response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
}
}
}