Alipay+ DocsAlipay+ Docs
APIs & SDKs

Post payment

After making a payment, further actions might be required, such as cancellation, and refund.

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.

The Acquiring Service Provider (ACQP) 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:

image.png

Figure 1. Payment cancellation flow initiated by the ACQP

The payment cancellation initiated by the ACQP contains the following steps:

  1. The ACQP submits the cancellation request to Alipay+ (step 1).
  2. 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 refund.
  • 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 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

CANCEL_WINDOW_EXCEED,please call the refund interface.

U

...

Unknown

Use the same parameter to retry the cancelPayment request.

  • In the first 60 seconds, you can retry the request with an interval of 5 to 10 seconds.
  • After 60 seconds, you can retry the request at least 10 times, with an interval of 5 minutes.
  • If keep receiving the result that indicates the status is U, contact connect_support@service.alipay.com.

No result received after trying several times

Unknown

Contact connect_support@service.alipay.com.

Sample

Sample request:

copy
{
 "paymentRequestId":"20200101234567897890"
}

Sample response:

copy
{
 "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 user.

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: image.png

Figure 2. Refund flow

The refund flow contains the following steps:

  1. The ACQP sends the refund request to Alipay+ with the ACQP paymentRequestId.
  2. 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 in your side to the value such as refunded.

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 with the previous one.

No result received

Unknown.

Sample

The ACQP sends a request to Alipay+.

copy
{
 "paymentRequestId":"20181129190741010007000000****",
 "refundRequestId":"20181129190741020007000000****",
 "refundAmount":{
    "value":"100",
    "currency":"JPY"
 } 
}

Alipay+ returns a response to the ACQP.

copy
{
 "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.