【问题标题】:Paypal REST API Subscription integration errorPaypal REST API 订阅集成错误
【发布时间】:2021-02-01 15:38:33
【问题描述】:

我正在尝试使用以下文档通过 PAYPAL REST API 集成 Paypal 订阅 https://developer.paypal.com/docs/subscriptions/integrate/(基础集成)

第 1 步(自动化成功) 第 2 步(成功创建产品) 第 3 步(成功创建计划)

第 4 步(创建订阅失败)
它看起来像是通过 JavaScript SDK 中的 Smart Payment Buttons 工作的。但是通过 REST API

curl -v -k -X POST https://api.sandbox.paypal.com/v1/billing/subscriptions \
  -H "Accept: application/json" \
  -H "Authorization: Bearer Access-Token" \
  -H "PayPal-Request-Id: SUBSCRIPTION-21092020-001" \
  -H "Prefer: return=representation" \
  -H "Content-Type: application/json" \
  -d '{
        "plan_id": "P-4ML8771254154362WXNWU5BC",
        "start_time": "2020-11-01T00:00:00Z",
        "quantity": "20",
        "shipping_amount": {
            "currency_code": "USD",
            "value": "10.00"
        },
        "subscriber": {
          "name": {
              "given_name": "John",
              "surname": "Doe"
          },
          "email_address": "customer@example.com",
          "shipping_address": {
              "name": {
                  "full_name": "John Doe"
              },
              "address": {
                  "address_line_1": "2211 N First Street",
                  "address_line_2": "Building 17",
                  "admin_area_2": "San Jose",
                  "admin_area_1": "CA",
                  "postal_code": "95131",
                  "country_code": "US"
              }
          }
        },
        "application_context": {
          "brand_name": "example",
          "locale": "en-US",
          "shipping_preference": "SET_PROVIDED_ADDRESS",
          "user_action": "SUBSCRIBE_NOW",
          "payment_method": {
              "payer_selected": "PAYPAL",
              "payee_preferred": "IMMEDIATE_PAYMENT_REQUIRED"
          },
          "return_url": "https://example.com/returnUrl",
          "cancel_url": "https://example.com/cancelUrl"
        }
      }'

我明白了

{"name":"INVALID_REQUEST","message":"Request is not well-formed, syntactically incorrect, or violates schema.","debug_id":"ec6f365217c37","details":[{"field":"/name","location":"body","issue":"MISSING_REQUIRED_PARAMETER","description":"A required field is missing."},{"field":"/payment_preferences","location":"body","issue":"MISSING_REQUIRED_PARAMETER","description":"A required field is missing."},{"field":"/billing_cycles","location":"body","issue":"MISSING_REQUIRED_PARAMETER","description":"A required field is missing."},{"field":"/product_id","location":"body","issue":"MISSING_REQUIRED_PARAMETER","description":"A required field is missing."}],"links":[{"href":"https://developer.paypal.com/docs/api/v1/billing/subscriptions#INVALID_REQUEST","rel":"information_link","method":"GET"}]}

我以所有可能的方式绑定,但我不知道如何调试问题以及我在创建订阅请求中缺少什么。谢谢!

【问题讨论】:

标签: paypal


【解决方案1】:

请尝试将 PayPal-Request-Id 作为唯一 ID 传递(Paypal 服务器将其存储为唯一 ID),它应该可以工作 更多详情请点击链接click 让我知道是否有效

【讨论】:

    【解决方案2】:

    PayPal REST API Error 400 in Google Apps Script

    这可能会有所帮助。
    问题是我必须JSON.stringify payload/body

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-07-05
      • 2020-04-29
      • 2013-08-20
      • 1970-01-01
      • 2016-11-16
      • 1970-01-01
      • 2017-06-21
      • 2021-09-18
      相关资源
      最近更新 更多