shopify支付api我已经为我的应用程序实现了这个api,并且成功地完成了支付,作为响应,我在url中获得了charge_id作为查询字符串。
但我知道如何在付款成功后交叉核对这笔费用。
我想在api的帮助下检查这个charge_id。请再次确认一下这个charge_id,我们收到了这笔款项。
api码
curl -X POST https://syzb.myshopify.com/admin/api/2022-07/graphql.json -H 'Content-Type: application/json' -H 'X-Shopify-Access-Token: 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' -d '{
"query": "mutation AppSubscriptionCreate($test: Boolean, $name: String!, $lineItems: [AppSubscriptionLineItemInput!]!, $returnUrl: URL! ){ appSubscriptionCreate(test: $test, name: $name, returnUrl: $returnUrl, lineItems: $lineItems) { userErrors { field message } appSubscription { id } confirmationUrl } }",
"variables": {
"test": true,
"name": "Premium +",
"returnUrl": "https://example.com/payment-success/?org=329BFBC5745344B58F321A1B842B73F8",
"lineItems": [
{
"plan": {
"appRecurringPricingDetails": {
"price": {
"amount": 99.50,
"currencyCode": "USD"
},
"interval": "EVERY_30_DAYS"
}
}
},
{
"plan": {
"appUsagePricingDetails": {
"terms": "Testing",
"cappedAmount": {
"amount": 10.25,
"currencyCode": "USD"
}
}
}
}
]
}
}'
发布于 2022-11-07 09:02:52
看一看官方的文档!
使用以下方法压缩资源:
curl -X GET "https://your-development-store.myshopify.com/admin/api/2022-10/recurring_application_charges/<charge_id>.json" \
-H "X-Shopify-Access-Token: {access_token}"
你的反应是这样的:
HTTP/1.1 200 OK
{
"recurring_application_charge": {
"id": 455696195,
"name": "Super Mega Plan",
"api_client_id": 755357713,
"price": "15.00",
"status": "pending",
"return_url": "http://yourapp.example.org",
"billing_on": "2022-10-03",
"created_at": "2022-10-03T12:44:45-04:00",
"updated_at": "2022-10-03T12:44:45-04:00",
"test": null,
"activated_on": null,
"cancelled_on": null,
"trial_days": 0,
"trial_ends_on": null,
"decorated_return_url": "http://yourapp.example.org?charge_id=455696195",
"confirmation_url": "https://jsmith.myshopify.com/admin/charges/755357713/455696195/RecurringApplicationCharge/confirm_recurring_application_charge?signature=BAh7BzoHaWRpBENfKRs6EmF1dG9fYWN0aXZhdGVU--b5f90d04779cc5242b396e4054f2e650c5dace1c"
}
}
如果付款成功,您需要检查的是status
值:
我希望这能帮到你!
发布于 2022-08-23 11:54:54
curl -X GET "收费/455696195.json“
-H“X Access-令牌:{access_token}”
https://stackoverflow.com/questions/73456297
复制相似问题