Post payment
After making a payment, further actions might be required, such as inquiry, cancellation, and refund.
Query the payment result
Acquiring Service Providers (ACQPs) can call the inquiryPayment interface to query the payment result of wallet when the payment result notification is not returned timely because of network or system problems.
The payment inquiry flow contains the following steps:
- The ACQP submits the inquiry request to Alipay+.
- Alipay+ returns the payment result to the ACQP.
Processing logic
Alipay+ returns the following two kinds of results:
- result: specifies the acceptance results of the inquiryPayment request.
- paymentReult: specifies the payment results.
Follow instructions below to handle the results:
result.resultStatus | paymentResult.resultStatus | Payment status | Actions |
S | S | Payment succeeds | Update the status from merchant side. |
S | F | If the paymentResult.resultCode value is | The merchant can reinitiate a payment request. |
S | U | Payment in process | Call the inquiryPayment interface to inquire the payment result. The inquiry request can be sent 30 to 60 times within 180 seconds. |
F | ... | The payment request fails or the order does not exist. |
|
U | ... | Unknown exception | Call the inquiryPayment interface to inquire the payment result. The inquiry request can be sent 30 to 60 times within 180 seconds. If you keep receiving the result that indicates the status is |
No result received | Unknown | Call the inquiryPayment interface to inquire the payment result. The inquiry request can be sent 30 to 60 times within 180 seconds. If still no result returns, call the cancelPayment interface. |
Samples
Sample request:
{
"paymentRequestId": "2020010123456789****"
}
Sample response:
{
"result": {
"resultCode": "SUCCESS",
"resultStatus": "S",
"resultMessage": "Success"
},
"paymentResult": {
"resultCode": "SUCCESS",
"resultStatus": "S",
"resultMessage": "Success"
},
"paymentId": "2020010123456789013****",
"paymentTime": "2020-01-01T12:01:01+08:30",
"paymentAmount": {
"value": "100",
"currency": "JPY"
},
"payToAmount": {
"value": "1000",
"currency": "KRW"
},
"customerId": "123****"
}
More information
For more information about how to use the interfaces (such as the field description), see inquiryPayment.
Cancel the transaction
The payment can be cancelled within the agreed cancellable period, which is from the time when the transaction is initiated to 00:15 UTC+8 of T+1 day, regardless of the payment status.
ACQPs can call the cancelPayment interface to cancel a payment in one of the following scenarios:
- The merchant/ACQP cannot receive the payment result from Alipay+ for a long time, or cannot obtain the payment result via the inquiryPayment interface.
- The transaction is not completed after exceeding the maximum number of inquiries.
The following figure illustrates the flow of payment cancellation initiated by the ACQP:
Figure 2. Payment cancellation flow initiated by the ACQP
The payment cancellation initiated by the ACQP contains the following steps:
- The ACQP submits the cancellation request to Alipay+ (step 1).
- Alipay+ returns the cancellation result to the ACQP (step 1.1).
Processing logic
- The cancel request only works on the payment, cannot be used on refunds.
- After you request a cancelation, you cannot change the order status to status other than cancelled. If payment notification comes later than the cancellation response, the ACQP handles the payment result based on the cancellation response. If the cancellation fails, you need to retry the cancelPayment request until the cancellation succeeds.
- You might receive different results from Alipay+, follow the instructions below to handle the result:
result.resultStatus | result.resultCode | Cancellation status | Further Actions |
S | SUCCESS | Cancellation succeeds | The merchant can reinitiate a payment request. |
F | ... | Cancellation fails | Take actions according to the error message in result.resultCode. Note: If the result.resultCode value returns as
|
U | ... | Unknown | Use the same parameter to retry the cancelPayment request.
|
No result received after trying several times | Unknown | Contact connect_support@service.alipay.com. |
Sample
Sample request:
{
"paymentRequestId":"20200101234567897890"
}
Sample response:
{
"acquirerId": "1111088000000000002",
"pspId":"1022172000000000001",
"result": {
"resultCode":"SUCCESS",
"resultStatus":"S",
"resultMessage":"success"
}
}
More information
For more information about how to use the interfaces (such as the field description), see cancelPayment.
Refund the payment
For successful payment transactions, the refund interface can be used to return funds to users.
Alipay+ support both full refund and multiple partial refunds. The total amount of multiple partial refunds cannot exceed the original amount paid by the user. The ACQP can initiate a refund transaction anytime within the refund expiration period (365 days by default) since the original payment transaction date.
The following figure illustrates the refund flow:
Figure 3. Refund flow
The refund flow contains the following steps:
- The ACQP sends the refund request to Alipay+ with the ACQP paymentRequestId.
- Alipay+ returns the refund result to the ACQP.
Processing logic
When call the refund interface, pay attention to the following items:
- The refundRequestId need to be unique.
- You might receive different results from Alipay+, follow instructions below to handle the result:
result.resultStatus | result.resultCode | Payment status | Actions |
S | SUCCESS | Refund succeeds. | Update the order status at your side to the value such as |
F | ... | Refund fails. | Take actions according to the error message in result.resultCode. |
U | ... | Refund is in processing. | Retry the same request until getting the response. Ensure that the parameters must be the same as the previous one. |
No result received | Unknown. |
Sample
The ACQP sends a request to Alipay+.
{
"paymentRequestId":"20181129190741010007000000****",
"refundRequestId":"20181129190741020007000000****",
"refundAmount":{
"value":"100",
"currency":"JPY"
}
}
Alipay+ returns a response to the ACQP.
{
"acquirerId": "102218800000000****",
"pspId":"102217200000000****",
"result": {
"resultCode":"SUCCESS",
"resultStatus":"S",
"resultMessage":"Success"
},
"refundId":"20181129190741020007000000****",
"refundTime": "2020-10-10T12:01:01+08:30"
}
More information
For more information about how to use the interfaces (such as the field description), see refund.