/v1/payments/notifyPayment

POST /v1/payments/notifyPayment

The notifyPayment API is used to notify  payment result to merchant/partner.

Note:

1) to notify merchant/partner the payment result when  payment processing reaches the final state (Success/Fail).

2) Not all scenario merchant/partner need receive this notify. Such as sync payment scenario(B Scan C, Agreement Pay).

Message structure

Request

Property

Data type

Required

Description

paymentIdString (64)

Yes

The unqiue ID of a payment generated by Wallet.
paymentRequestIdString (64)

Yes

The unqiue ID of a payment generated by Wallet merchants.
paymentAmountAmount

Yes

Order amount for display of user consumption records, payment results page.
paymentTime

String/Datetime

No

Payment success time, which follows the ISO 8601 standard.

paymentResult

JSON

Yes

resultStauts:

S - order is succeeded.

F - order is failed.

paymentFailReasonString (256)

No

The fail reason of payment order when paymentStatus is FAIL.

extendInfoString (4096)

No

The extend information,wallet and merchant can put extend info here.

Response

Property

Data type

Required

Description

result

Result

Yes

The request result, which contains information related to the request result, such as status and error codes.

Result Process Logic

  • If result.resultStatus == S, Means the merchant/partner already received this notification.
  • If result.resultStatus == F, it means merchant/partner handle this notification failed.
  • If result.resultStatus==U, it means merchant/partner handle this notification occur unknown exception, wallet will retry if get U response.
  • If other response (almost never occur),wallet will process like U.

Result

NoresultStatusresultCoderesultMessage

1

SSUCCESSSuccess.

2

UUNKNOWN_EXCEPTIONAn API calling is failed, which is caused by unknown reasons.

3

UREQUEST_TRAFFIC_EXCEED_LIMITThe request traffic exceeds the limit.

4

F

REPEAT_REQ_INCONSISTENTRepeated submit, and requests are inconsistent.

5

FPROCESS_FAILA general business failure occurred. Don't retry.

6

FINVALID_APIThe called API is invalid or not active.

7

FPARAM_ILLEGALIllegal parameters. For example, non-numeric input, invalid date.

Sample

/v1/payments/notifyPayment
  1. The Mini Program calls my.tradePay interface to do payment (Step 1).
  2. E-wallet App returns payment result to the Mini Program (Step 5).
  3. E-wallet notifies the payment result with paymentNotifyUrl provided by merchant (Step 4).

For example, a wallet user purchases a 10000 MYR merchandise at a  merchant/partner, after user finished payment in wallet cashier page, wallet will send payment notification to merchant/partner.

Payment

A. Request sample with payment success

copy
{
    "paymentResult": {
        "resultStatus": "S",
        "resultCode": "SUCCESS",
        "resultMessage": "success"
    },
    "paymentId": "20210726111212800110171163001220213",
    "paymentRequestId": "6-20210714041658535w",
    "customerId": "1000000839990000",
    "paymentTime": "2021-07-26T12:13:50+08:00",
    "paymentAmount": {
        "currency": "MYR",
        "value": "10000"
    }
}
  • paymentId is generated by Wallet, uniquely identifies the payment.
  • paymentRequestId is generated by merchant/partner, uniquely identifies this payment. In payment notify request, paymentRequestId should be the paymentRequestId in origin payment request.
  • paymentAmount describes the amount of 10000 MYR already collected by Wallet from user account for this payment.
  • paymentTime is the success date time of this transaction.
  • paymentResult is the payment status in wallet. resultStatus "S" means transaction already success.

B. Request sample with payment failed

copy
{
    "paymentResult": {
        "resultStatus": "F",
        "resultCode": "ORDER_IS_CLOSED",
        "resultMessage": "ORDER_IS_CLOSED"
    },
    "paymentId": "20210722111212800110171936301182782",
    "paymentRequestId": "6-20210722010156790E",
    "customerId": "216810000000000090000"
}
  • paymentResult is the payment status in wallet. resultStatus "F" means this transaction already failed, usually payment fail are because of this payment already expired .
  • paymentFailReason used to fill the payment fail reason, only payment status is FAIL will return this parameter.

Response

copy
{
 "result": {
    "resultCode":"SUCCESS",
    "resultStatus":"S",
    "resultMessage":"success"
  }
 }
  • result.resultStatus==S  shows that merchant/partner already received this notification.