[关闭]
@chengxuyuan 2019-01-09T03:04:36.000000Z 字数 1411 阅读 430

苹果支付和订单

橙旭园儿童编程


苹果支付之前生成一个订单

支付完成后用苹果返回的 data 验证订单

生成直播课订单

Method and URL Structure

Method Method Resource URL Descriptions Authentications Required
POST /server/market/live_course/purchase/${pk}/ 生成订单 YES

Request Parameters

Name Description Required Default
channel 支付渠道 NO ali_pay

Request Data

  1. {
  2. "channel": "apple"
  3. }

cURL Example

  1. curl -H 'Content-Type: application/json' -H 'Authorization: Token cbc89752fe759cd0365453a90151b7375612f9d1' --data '{..}' -X POST http://localhost/server/market/live_course/purchase/1/

Response

  1. {
  2. "amount":"100.00",
  3. "rent_course_id":"1",
  4. "channel":"apple",
  5. "order_number":"17363431881548582736220001",
  6. "channel_display":"苹果支付",
  7. "status":0,
  8. "status_display":"待付款",
  9. "is_done":false,
  10. "order_type_display":"租凭",
  11. "apple_product_id":"test_apple_001"
  12. }

验证订单

Method and URL Structure

Method Method Resource URL Descriptions Authentications Required
PUT /server/market/apple_order/payment/${order_number}/ 验证订单 YES

Request Parameters

Name Description Required Default
receipt_data 苹果返回的数据 YES

Request Data

  1. {
  2. "receipt_data": {...}
  3. }

cURL Example

  1. curl -H 'Content-Type: application/json' -H 'Authorization: Token cbc89752fe759cd0365453a90151b7375612f9d1' --data '{..}' -X PUT http://localhost/server/market/apple_order/payment/17363431881548582736220001/

Response

  1. {
  2. "amount":"100.00",
  3. "rent_course_id":"1",
  4. "channel":"apple",
  5. "order_number":"17363431881548582736220001",
  6. "channel_display":"苹果支付",
  7. "status":0,
  8. "status_display":"已支付",
  9. "is_done":true,
  10. "order_type_display":"直播课程",
  11. "apple_product_id":"test_apple_001"
  12. }
添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注