Payment
1.Overview
Use this API to get the cashier page address. After getting the cashier page address, you can redirect the user to the cashier page to make a payment.
2.Request Info
Method: post
Path: https://prod-openapi.newpay.la/api/open/converge/pay/v1/m/createOrder
2.1 Request Header
Key | Value |
---|---|
Content-Type | application/json |
version | 1.0 |
2.2 Request Data
Name | Description | Type | Required |
---|---|---|---|
appId | Unique identifier assigned to a third-party application platform | string | true |
merchantId | Unique identifier assigned to a third-party merchant | string | true |
timestamp | Request timestamp | timestamp | true |
sign | Data signature | string | true |
payMethod | Payment method: 1.NewPay;5.WeChat;6:Alipay | int | true |
currency | Payment currency, LAK/USD | string | true |
orderAmt | Payment amount | string | true |
orderNo | Order number,The unique number assigned by a merchant to identify a payment request. | string | true |
callBackUrl | Payment result notification URL | string | true |
successPageUrl | Transfer address of successful payment | string | true |
failurePageUrl | Payment failed to jump address | string | true |
cancelPageUrl | Cancel the payment redirect address | string | true |
subject | Commodity title | string | false |
extra | Third party order supplementary fields ,If alipay, the alphabet should include ANDROID or IOS | string | false |
2.3 Response Data
Name | Description | Type |
---|---|---|
success | Success flag: true/false | boolean |
message | Response message | string |
code | Reponse code | string |
timestamp | Response timestamp | long |
data | Result | object |
> appId | Unique identifier assigned to a third-party application platform | string |
> sign | Data signature | string |
> tranAbbr | Transaction Type | string |
> tranNo | Transaction Number | string |
> orderAmt | Payment amount | string |
> payUrl | Payment address | string |
> orderNo | Order number | string |
> newpayOrderNo | NewPay order number | string |
3. Example Data
3.1 Request
{
"appId": "3514d69403bc4ce1a8fafb6415a31018",
"timestamp": {{current_timestamp}},
"sign": "{{sign}}",
"payMethod": 1,
"extra": "",
"currency": "LAK",
"orderAmt": 50000,
"merchantId": "876266cdc7154dd08a022fd1f2eace55",
"orderNo": "ORDERNO000000000A104",
"subject": "name002",
"callBackUrl": "www.1231123.com",
"successPageUrl": "https://prod.newpay.la:8071/jdb/success.html",
"failurePageUrl": "https://prod.newpay.la:8071/jdb/failure.html",
"cancelPageUrl": "https://prod.newpay.la:8071/jdb/cancel.html"
}
3.2 Response
{
"success": true,
"message": "success",
"data": {
"appId": "3514d69403bc4ce1a8fafb6415a31018",
"sign": "ALa4W6EDAKpZGEuCfpmemOA346bZw6CGrbsy6Xo6J2wYLOldSUrUVyEI0DLpZmHU9tIVp4gi/DENq3rj/nZtXn9grXWhLbX4G+IMEVb3TKEIwTDWZ++I1OfgtuUxOHof711p6A4ga95Xm645Qly/HV8YHoogI7SOw/w352TElhw37o/pIKsSWfeTpXtpfjRs3o69x4EVpDQ0DmYW5zVBCEriBqHvLqjbacOl3HGTa93oALbgQKa5ftAENBOmxi1zNxCOsY+Ecq4apK3tdma1RL+AmrBgmQu8O2vEIWBmlSxg1CY1ZUw2IHixV8D2HHHAn7RQjoDDFePelyB+CLS3GA==",
"tranAbbr": "FP1005",
"tranNo": "00012022090700000015",
"orderAmt": "50000",
"payUrl": "http://192.168.10.105:8072/BECLPay/page.html?orderNo=202209076000000321",
"orderNo": "ORDERNO000000000A104",
"newpayOrderNo": "202209076000000321"
},
"code": "0",
"timestamp": "1662521235625"
}
4. Response Code
Code | Description |
---|---|
0 | success |
E9999 | unknow error |
B11095 | Illegal request |
Z00046 | whitelist authentication failed |
Z00003 | appid field wrong |
Z00044 | merchantId field wrong |
Z00007 | sign field verification failed |
Z00020 | orderAmt field illegal(when the currency is LAK, no decimals are allowed) |
Z00001 | appid field illegal |
Z00004 | timestamp field illegal |
Z00005 | sign field illegal |
Z00011 | payMethod field illegal |
Z00013 | extra field illegal |
Z00016 | currency field illegal |
Z00018 | orderAmt field illegal |
Z00021 | merchantId field illegal |
Z00023 | orderNo field illegal |
Z00025 | subject field illegal |
Z00032 | callBackUrl field illegal |
Z00035 | successPageUrl field illegal |
Z00038 | failurePageUrl field illegal |
Z00043 | cancelPageUrl field illegal |
Z00047 | this payment channel is not supported |
Z01012 | appId or merchantId is not valid |
Z01002 | agreement error |
Z00039 | transaction failed |
Z01004 | collection account does not exist |
Z01005 | abnormal account status |
Z01028 | order number is not available, please change |
Z01008 | the order has been completed |
Z01009 | the order has expired |
Z01010 | payment failed for this order |
Z01011 | the order has been cancelled |
5. Wake Up NewPay App
Invoke NewPay payment through AppLink open, which is the payUrl field in the order response data
5.1 iOS
objective-c eg:
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:response.data.payUrl] options:@{} completionHandler:nil];
swift eg:
let url = URL(string: response.data.payUrl)!
UIApplication.shared.open(url, options: [:], completionHandler: nil)
5.2 Android
Java eg:
String payUrl= response.getData().getPayUrl();
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(payUrl));
startActivity(intent);
Kotlin eg:
val payUrl = response?.data?.payUrl!!;
val intent = Intent(Intent.ACTION_VIEW, Uri.parse(payUrl))
startActivity(intent)