Overview

PaymentStatus follows GetPayment in an Alipay checkout flow. The RequestUrl from the GetPayment response is used to redirect the user to the Alipay cashier login page. After a user authenticates and confirms the order on the Alipay website, the user is redirected back to the webstore, using the ReturnUrl value from the GetPayment request. At that point, the webstore should send a PaymentStatus request to confirm that the funds have been collected from the user's account.

The same OrderId must be used between GetPayment and the PaymentStatus requests.

In the PaymentStatus response, the most important and useful element is ResponseCode. ResponseCode is used to determine if Alipay was able to succesfully secure the funds for the order. The order can be accepted when ResponseCode is Success and must be rejected if the value is Fail

URI Summary

Action URI Template URI Example Non-URI Request Response
POST /vM.m/stores/StoreId/payments/alipay/paymentStatus.[format] /v1.0/stores/AStoreId/payments/alipay/paymentStatus.xml XML 200 + XML Response containing Alipay redirect url

Request Elements

When preparing the request, consider the following data note:

  • The OrderId value must match the OrderId used in the AlipayGetPayment request that generated the Alipay RequestURL for redirecting the user for the transaction.
Element Required Description Type Restriction
StoreId Yes Store identifier used in the URL. String 20 Characters
/AlipayPaymentStatusRequest/OrderId Yes Order identifier. String Min 1 Character
Max 20 Characters
/AlipayPaymentStatusRequest/Amount Yes Currency amount being authorized on the credit card Decimal

Positive decimal, up to two decimal places (for example, 4.75)

/AlipayPaymentStatusRequest/Amount/@currencyCode Yes Type of currency used for the order String 3-character ISO 4217 code (for example, USD, CAD, EUR). See http://en.wikipedia.org/
wiki/ISO_4217.

Request Example

The request is a AlipayPaymentStatusRequest message.

Copy this code sample.

 <?xml version="1.0" encoding="UTF-8"?>
  <AlipayPaymentStatusRequest xmlns="http://api.gsicommerce.com/schema/checkout/1.0" requestId="1234567">
    <OrderId>12345</OrderId>
    <Amount currencyCode="USD">60.00</Amount>
  </AlipayPaymentStatusRequest>

Response Elements

Element Required Description Type Restriction
/AlipayPaymentStatusReply/OrderId Yes Order identifier. String Min 1 Character
Max 20 Characters
/AlipayPaymentStatusReply/Status Yes Status of the authorization. Includes PAID, PENDING, REJECTED, ERROR and TIMEOUT.
Only orders with a Success, Pending or Timeout Status are submitted to the Order Service.
Enum Can be any of the below status,
PAID,
PENDING,
REJECTED,
ERROR,
TIMEOUT

Successful Response Example

The response is a AlipayPaymentStatusReply message.

Copy this code sample.
<?xml version="1.0" encoding="UTF-8"?>
<AlipayPaymentStatusReply xmlns="http://api.gsicommerce.com/schema/checkout/1.0">
  <OrderId>12345</OrderId>
  <Status>PAID</Status>
</AlipayPaymentStatusReply>

Retryable Response Example

The response is a payment pending AlipayPaymentStatusReply message.

Copy this code sample.
<?xml version="1.0" encoding="UTF-8"?>
<AlipayPaymentStatusReply xmlns="http://api.gsicommerce.com/schema/checkout/1.0">
  <OrderId>12345</OrderId>
  <Status>PENDING</Status>
</AlipayPaymentStatusReply>

Timeout Response Example

The response is a timeout AlipayPaymentStatusReply message.

Copy this code sample.
<?xml version="1.0" encoding="UTF-8"?>
<AlipayPaymentStatusReply xmlns="http://api.gsicommerce.com/schema/checkout/1.0">
  <OrderId>12345</OrderId>
  <Status>TIMEOUT</Status>
</AlipayPaymentStatusReply>

Failure Response Example

The response is a AlipayPaymentStatusReply message.

Copy this code sample.
<?xml version="1.0" encoding="UTF-8"?>
<AlipayPaymentStatusReply xmlns="http://api.gsicommerce.com/schema/checkout/1.0">
  <OrderId>12345</OrderId>
  <Status>REJECTED</Status>
</AlipayPaymentStatusReply>

Error Response Example

The response is a AlipayPaymentStatusReply message.

Copy this code sample.
<?xml version="1.0" encoding="UTF-8"?>
<AlipayPaymentStatusReply xmlns="http://api.gsicommerce.com/schema/checkout/1.0">
  <OrderId>12345</OrderId>
  <Status>ERROR</Status>
</AlipayPaymentStatusReply>

Next Step

After a successful PaymentStatus call, the next step in the Alipay checkout flow is to confirm the order to the user.