Herald
OpenapiBilling

Create_payment_attempt

POST
/api/bill/purchase/payment-attempts

Authorization

bearer_auth
headerAuthorizationBearer <token>

Request Body

Creates a payment attempt. Optional flow: "hosted" (default) returns the provider's hosted checkout URL; "payment_intent" (stripe + one-time purchases only) returns a raw PaymentIntent clientSecret for mobile wallet SDK confirmation (Apple Pay / Google Pay).

application/json
  1. body
flow?|

Checkout flow: "hosted" (default) redirects to the provider's hosted checkout page; "payment_intent" returns a raw Stripe PaymentIntent clientSecret for mobile wallet SDK confirmation (Apple Pay / Google Pay). payment_intent is only valid for stripe + one-time purchases.

locale?|

App locale tag (e.g. en, zh-CN) used to localize the provider's hosted checkout page. Unrecognized values are dropped by the provider clients (fail-open to the provider default language).

metadata?unknown
openid?|

WeChat JSAPI payer openid; required when paymentScene = "jsapi".

paymentProvider*string
paymentScene?|

WeChat-only checkout scene: "native" (default) or "jsapi". Ignored by other providers (DEC-wechat-support-009).

targetId*string
Formatuuid
targetType*string

Response Body

Payment attempt created successfully

application/json
  1. response
amount*integer
Formatint64
createdAt*string
currency*string
expiresAt*string
id*string
Formatuuid
paymentContext*
paymentProvider*string
realmId*string
status*string
targetId*string
Formatuuid
targetType*string
userId*string
Formatuuid
Example Request
curl -X POST 'https://example.com/api/bill/purchase/payment-attempts' \
  -H 'Content-Type: application/json' \
  -d '{
  "paymentProvider": "string",
  "targetId": "cbca1126-180e-4334-9df8-cf82289d378b",
  "targetType": "string"
}'
Example Response
{
  "amount": 0,
  "createdAt": "string",
  "currency": "string",
  "expiresAt": "string",
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "paymentContext": {
    "clientSecret": "string",
    "creemCheckoutUrl": "string",
    "stripeCheckoutUrl": "string",
    "wechatCodeUrl": "string",
    "wechatJsapiParams": null
  },
  "paymentProvider": "string",
  "realmId": "string",
  "status": "string",
  "targetId": "cbca1126-180e-4334-9df8-cf82289d378b",
  "targetType": "string",
  "userId": "2c4a230c-5085-4924-a3e1-25fb4fc5965b"
}