首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >如何在使用shopify支付网关进行付款后验证收费id

如何在使用shopify支付网关进行付款后验证收费id
EN

Stack Overflow用户
提问于 2022-08-23 09:32:27
回答 2查看 137关注 0票数 0

shopify支付api我已经为我的应用程序实现了这个api,并且成功地完成了支付,作为响应,我在url中获得了charge_id作为查询字符串。

但我知道如何在付款成功后交叉核对这笔费用。

我想在api的帮助下检查这个charge_id。请再次确认一下这个charge_id,我们收到了这笔款项。

api码

代码语言:javascript
运行
复制
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"
            }
          }
        }
      }
    ]
  }
}'
EN

回答 2

Stack Overflow用户

发布于 2022-11-07 09:02:52

看一看官方的文档

使用以下方法压缩资源:

代码语言:javascript
运行
复制
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}"

你的反应是这样的:

代码语言:javascript
运行
复制
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值:

  • 待定:经常性费用待定。
  • 接受:在2021-01版中删除。经常性费用已被接受。从API版本2021-01开始,当商家接受一项收费时,该费用将立即从挂起转为活动。
  • 活动:重复充电被激活。这是导致商人被起诉的唯一状态。从API版本2021-01开始,当商家接受一项收费时,该费用将立即从挂起转为活动。
  • 谢绝:经常性费用已被降低。
  • 过期:在创建后2天内不接受经常性费用。
  • 冻结:由于商店订阅未付款,经常性费用被搁置.一旦订阅付款恢复,收费将重新启动。
  • 取消:开发商取消了费用。

我希望这能帮到你!

票数 0
EN

Stack Overflow用户

发布于 2022-08-23 11:54:54

页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/73456297

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档