【问题标题】:Where can I find a full list of PayPal Checkout Button properties?我在哪里可以找到 PayPal Checkout Button 属性的完整列表?
【发布时间】:2019-02-18 23:08:12
【问题描述】:

PayPal Checkout 提供一个 JavaScript 函数来显示按钮示例:

<script>
  paypal.Buttons({
    createOrder: function(data, actions) {
      // Set up the transaction
      return actions.order.create({
        purchase_units: [{
          amount: {
            value: '0.01'
          }
        }]
      });
    }
  }).render('#paypal-button-container');
</script>

如您所见,Buttons 函数有一个对象作为参数。在哪里可以查看此对象的所有可用属性?

【问题讨论】:

    标签: javascript paypal


    【解决方案1】:

    查看https://developer.paypal.com/docs/api/orders/v2/#orders_create

    请求正文部分包含所有可以传递的数据。

    【讨论】:

    • PayPal Checkout 是一组不同的 API,它与 Orders API 不同
    • 你尝试的是一个javascript SDK,它在内部调用这个Orders API来建立一个交易。参考developer.paypal.com/docs/checkout/#how-the-buttons-work
    • 这可能是事实,但我问的是javascript库按钮函数参数对象。这个对象可能有不同的属性集,因为它是 JS 库,而不是基础 API。
    【解决方案2】:
    【解决方案3】:

    这里有你需要的所有东西的完整列表

    "purchase_units": [
        {
          "reference_id": "store_mobile_world_order_1234",
          "description": "Mobile World Store order-1234",
          "amount": {
            "currency": "USD",
            "details": {
              "subtotal": "1.09",
              "shipping": "0.02",
              "tax": "0.33"
            },
            "total": "1.44"
          },
          "payee": {
            "email": "seller@example.com"
          },
          "items": [
            {
              "name": "NeoPhone",
              "sku": "sku03",
              "price": "0.54",
              "currency": "USD",
              "quantity": "1"
            },{
              "name": "Fitness Watch",
              "sku": "sku04",
              "price": "0.55",
              "currency": "USD",
              "quantity": "1"
            }
          ],
          "shipping_address": {
            "line1": "2211 N First Street",
            "line2": "Building 17",
            "city": "San Jose",
            "country_code": "US",
            "postal_code": "95131",
            "state": "CA",
            "phone": "(123) 456-7890"
          },
          "shipping_method": "United Postal Service",
          "partner_fee_details": {
            "receiver": {
              "email": "partner@example.com"
            },
            "amount": {
              "value": "0.01",
              "currency": "USD"
            }
          },
          "payment_linked_group": 1,
          "custom": "custom_value_2388",
          "invoice_number": "invoice_number_2388","payment_descriptor": "Payment Mobile World"
        }
      ],
      "redirect_urls": {
        "return_url": "https://example.com/return",
        "cancel_url": "https://example.com/cancel"
      }
    }'
    

    【讨论】:

      猜你喜欢
      • 2015-03-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-07-01
      • 1970-01-01
      • 2019-05-01
      • 1970-01-01
      • 2017-04-12
      相关资源
      最近更新 更多