POST 請求範例
以下範例假設:
- Webhook URL:http://www.viveport.com:1234/callback
- API 金鑰:Regma6NmRtOlvIa9XvYTurfxvIjcbTA9
- 方式:POST
發送到開發人員伺服器的訂閱請求:
> POST / HTTP/1.1 > Host: www.viveport.com:1234/callback > User-Agent: insomnia/5.15.0 > content-type: application/json > hash: oqbKgDJvJxRmsqDarSQLzMsimSI= > pattern: ZDFScU4yMTRVVkp5VjNGRGMyWkROVFJZUmpkVldqTktOR1JFTVE9PQ== > Accept: / > Content-Length: 504 {“subscription”: { “app_id”:”d5298a08-7d0d-4489-be07-bd94577b5af0”,”order_id”:” QP-93d468a6-2476-4844-988c-22690f33f2f5”,”subscription_id”:”QP-93d468a6-2476-4844-988c-22690f33f2f5”,”price”:”100.0”,”currency”:”CNY”,”subscribed_timestamp”:1494862002956,”free_trial_period”:{“time_type”:”day”,”value”:3},”charge_period”:{“time_type”:”month”,”value”:1},”number_of_charge_period”:12,”plan_id”:”87f7acc8-681e-40b0-8b7d-e3bc399adfa9”,”plan_name”:”Free trial 3 days subsciption”,”user_data”:”“,”status”:”ACTIVE”}} * upload completely sent off: 504 out of 504 bytes < HTTP/1.1 200 OK
向開發者伺服器發送的購買請求:
> POST / HTTP/1.1 > Host: www.viveport.com:1234/callback > User-Agent: insomnia/5.15.0 > content-type: application/json > hash: nzE1aS83lg+2LLKFKaU2vr2suVI= > pattern: NkxEazk0VEd6S0V4NUszSG05TUVwVjJqcFViTg== digest: nzE1aS83lg+2LLKFKaU2vr2suVI= > Accept: / > Content-Length: 406 {“purchase”:{“order_id”:”fcab81c0-023a-443c-9aa5-b8a6c4e34b59”,”purchase_id”:”fcab81c0-023a-443c-9aa5-b8a6c4e34b59”,”price”:”100.0”,”currency”:”CNY”,”app_id”:”34e67404-c370-41a2-84bc-e19700f65342”,”app_name”:”IAP Test Item”,”paid_timestamp”:1491363920937,”status”:”success”,”user_data”:”“,”item_list”:{“item_id”:”1”,”quantity”:1,”subtotal_price”:”100”,”category”:”IAP Test Ttem”,”description”:”test item”}}} * upload completely sent off: 406 out of 406 bytes < HTTP/1.1 200 OK