POST /payment/{merchant}

Create a payment


  • The real IP address of client, e.g.

  • Client ID, that can be customer ID

Path parameters

  • merchant string Required

    Merchant name to payment company, e.g. weixinpay.test


  • paymentMethod string Required

    Payment method, must be wechatpay or alipay

    Values are wechatpay or alipay.

  • paymentType string Required

    Payment companies have different payment types

    Values are NATIVE, H5, JSAPI, MINIPRO, or APP.

  • orderRef string Required

    Merchant system order number

  • actualAmount integer Required

    Order actual amount, which uses the base unit of current currency

  • total integer

    Order total amount, which uses the base unit of current currency

  • Subsidy amount, only works when profitSharing is True

  • costPrice integer

    When the original order price is not equal to the payment amount, the discount will not be enjoyed. This field is mainly used to prevent the same invoice from being paid multiple times to enjoy multiple discounts.

  • Merchant invoice ID, need to use with products data

  • currency string Required

    Must be CNY or GBP

  • Whether the order is going to share profit

    Default value is true.

  • products array[object] | null

    Payment product

  • Order product description

  • attach string

    Payment attach data, which could be used by payment notifies

  • Payment due time

  • goodsTag string

    Coupon goods tag

  • payerId string

    Payer ID of customer in service provider side.

  • Payer ID of customer in merchant side.

  • Notify url, that is used by payment company.

  • Success url, that is used by alipay company.

  • Cancel url, that is used by alipay company.

  • spAppId string

    App ID of payment company.


  • 200 object

    Create a payment successfully.

    • code integer(int32)
    • message string | null

      Response message

    • payMessage string | null

      Payment message responsed from payment company

    • payInvokeMessage string | null

      Payment invoked message responsed from payment company

    • timeStamp string | null

      Timestamp, used to sign

    • nonceStr string | null

      Random string up to 32 characters, used to sign

  • 401 object

    Not Authenticated.

  • 422 object

    Request validation failure

  • 500 object

    Something wrong when making the payment.

POST /payment/{merchant}
curl \
 -X POST \
 -H "app-api-key: $API_KEY" \
 -H "Content-Type: application/json" \
 -H "X-Real-Ip: string" \
 -H "Client-Id: string" \
 -d '{"paymentMethod":"wechatpay","paymentType":"H5","orderRef":"O123456789","actualAmount":2200,"total":2200,"subsidyAmount":0,"costPrice":0,"invoiceId":"string","currency":"CNY","profitSharing":true,"products":[{"goodsName":"Orange","goodsCategory":"health-beauty/fragrance","goodsUnitPrice":12,"goodsQuantity":1,"merchantProductId":"barcode123456","paymentProductId":1246464644}],"description":"面膜 mask","attach":"Payment attach mark","timeExpire":"2022-02-24T14:02:38Z","goodsTag":"new","payerId":"osGEYs0HfdUF4R965HMmEPKqOSWw","merchantPayerId":"osGEYs0HfdUF4R965HMmEPKqOSWw","notifyUrl":"","successUrl":"","cancelUrl":"","spAppId":"string"}'
Request example
# Headers
X-Real-Ip: string
Client-Id: string

# Payload
  "paymentMethod": "wechatpay",
  "paymentType": "H5",
  "orderRef": "O123456789",
  "actualAmount": 2200,
  "total": 2200,
  "subsidyAmount": 0,
  "costPrice": 0,
  "invoiceId": "string",
  "currency": "CNY",
  "profitSharing": true,
  "products": [
      "goodsName": "Orange",
      "goodsCategory": "health-beauty/fragrance",
      "goodsUnitPrice": 12,
      "goodsQuantity": 1,
      "merchantProductId": "barcode123456",
      "paymentProductId": 1246464644
  "description": "面膜 mask",
  "attach": "Payment attach mark",
  "timeExpire": "2022-02-24T14:02:38Z",
  "goodsTag": "new",
  "payerId": "osGEYs0HfdUF4R965HMmEPKqOSWw",
  "merchantPayerId": "osGEYs0HfdUF4R965HMmEPKqOSWw",
  "notifyUrl": "",
  "successUrl": "",
  "cancelUrl": "",
  "spAppId": "string"
Response example (200)
  "code": 200,
  "message": "success",
  "payMessage": "",
  "payInvokeMessage": "weixin://wap/pay?prepayid%3Dwx03143347..",
  "timeStamp": 1414561699,
  "nonceStr": "5K8264ILTKCH16CQ2502SI8ZNMTM67VS"
Response example (401)
  "code": 200,
  "message": "success"
Response example (422)
  "code": 200,
  "message": "success"
Response example (500)
  "code": 200,
  "message": "success",
  "errors": "Something wrong when making the service."