Payment and checkout API¶
Checkout page, Alipay/PayPal order creation and callbacks.
checkout page¶
- interface address:
/checkout
- HTTP request method:
GET
- request params:
plan (query, optional): plan, such as free / standard / pro / ultra
- response code:
200: returns the checkout page HTML
Note: the corresponding price is displayed according to the plan and the language (for example, CNY for zh and USD for en).
alipay create order (redirect)¶
- interface address:
/checkout/alipayorders
- HTTP request method:
GET
- request params:
amount (query, required): the payment amount, such as 69.99
- response code:
302: redirects to the Alipay payment page
Note: creates an Alipay order and redirects to payment; login is required. After a successful payment it redirects to /pay/back (or the configured callback address).
alipay return (redirect)¶
- interface address:
/checkout/alipayback
- HTTP request method:
GET
- request params:
Alipay synchronous callback query parameters
- response code:
302: redirects to /billing
Note: after the user completes the payment, Alipay synchronously redirects to this address, and the server then redirects to /billing. Signature verification and order updating are described in the implementation.
paypal create order¶
- interface address:
/checkout/paypalorders
- HTTP request method:
POST
- request params:
Body JSON:
{ "cart": [ { "plan": "pro" | "ultra" | "custom", "quantity": "1" } ] }
- response code:
200: returns the PayPal order object (including id, links, etc.)
response example:
JSON: PayPal Create Order response (including id, status, links, etc.)
paypal capture order¶
- interface address:
/checkout/paypalorders/:id/capture
- HTTP request method:
POST
- request params:
id (path): PayPal order ID
- response code:
200: returns the PayPal capture result
response example:
JSON: PayPal Capture Order response