Create Order

Through this interface, you can create a recharge order for the application. After creating the order, a payment link will be returned, and the amount will be automatically credited after the user completes the payment.

This interface requires authentication, please refer to Platform Token for details.

Interface Description

  • Request Method: POST
  • Request URL: https://platform.acedata.cloud/api/v1/orders/
  • Request Headers:
    • accept: application/json
    • content-type: application/json
    • authorization: Bearer {token}

Request Parameters

Parameter Type Required Description
application_id string Yes The ID of the application to be recharged
package_id string Yes Package ID
pay_way string Yes Payment method: WechatPay, AliPay, Stripe, X402
amount number No Custom amount (supported by some packages)

CURL Request Example

curl -X POST \
  -H "accept: application/json" \
  -H "content-type: application/json" \
  -H "authorization: Bearer {token}" \
  -d '{
    "application_id": "107f8d0f-e465-4a7e-a49e-d633d26f7aa2",
    "package_id": "pkg-uuid",
    "pay_way": "Stripe"
  }' \
  "https://platform.acedata.cloud/api/v1/orders/"

Response Result Example

{
  "id": "order-uuid-1234",
  "user_id": "b87f67c1-b04f-4332-99a1-7a5e651331c6",
  "application_id": "107f8d0f-e465-4a7e-a49e-d633d26f7aa2",
  "package_id": "pkg-uuid",
  "amount": 500,
  "price": 49.99,
  "discount": 1.0,
  "pay_way": "Stripe",
  "pay_id": null,
  "pay_url": "https://checkout.stripe.com/pay/cs_live_xxxx",
  "state": "Pending",
  "remaining_amount": 0,
  "tags": null,
  "metadata": null,
  "created_at": "2024-08-01T10:00:00.000000Z",
  "updated_at": "2024-08-01T10:00:00.000000Z"
}

Payment Process

  1. Call the create order interface to obtain the pay_url.
  2. Guide the user to redirect to the pay_url to complete the payment.
  3. After the payment is completed, the order status will change from Pending to Paid, and then automatically to Finished.
  4. Once the order status changes to Finished, the corresponding amount will be automatically credited to the application.

Payment Method Description

Payment Method Description
Stripe International credit/debit card payment (USD)
WechatPay WeChat payment (CNY, the platform will automatically convert the exchange rate)
AliPay Alipay payment (CNY, the platform will automatically convert the exchange rate)
X402 Cryptocurrency payment (USDC, supports Solana and Base chains)

Code Example

Python:

import requests

url = "https://platform.acedata.cloud/api/v1/orders/"
headers = {
    "accept": "application/json",
    "content-type": "application/json",
    "authorization": "Bearer {token}"
}
data = {
    "application_id": "107f8d0f-e465-4a7e-a49e-d633d26f7aa2",
    "package_id": "pkg-uuid",
    "pay_way": "Stripe"
}

response = requests.post(url, json=data, headers=headers)
order = response.json()

print(f"Order ID: {order['id']}")
print(f"Payment Amount: ${order['price']}")
print(f"Payment Link: {order['pay_url']}")