【问题标题】:PayPal Checkout - Set up the transaction shipping address and shipping amountPayPal Checkout - 设置交易送货地址和送货金额
【发布时间】:2019-07-11 11:50:54
【问题描述】:

贝宝结账

Set up the transaction

允许设置像mount.value: '0.01这样的参数和其他类似的东西

<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>

但我需要设置送货地址和送货金额。我该怎么做?

PS 我找到了Orders API Integration Guide for Express Checkout。它有所有选项

喜欢details.shipping = 0.00 ...

shipping_address,但它不适用于 PayPal Checkout 示例。是因为我在发件箱里测试吗?

【问题讨论】:

    标签: paypal


    【解决方案1】:

    以下是您可以设置的完整参数列表:

        {
           "intent": "AUTHORIZE",
           "application_context": {
        "return_url": "https://example.com",
        "cancel_url": "https://example.com",
        "brand_name": "EXAMPLE INC",
        "locale": "en-US",
        "landing_page": "BILLING",
        "shipping_preference": "SET_PROVIDED_ADDRESS",
        "user_action": "CONTINUE"
      },
      "purchase_units": [
        {
          "reference_id": "PUHF",
          "description": "Sporting Goods",
          "custom_id": "CUST-HighFashions",
          "soft_descriptor": "HighFashions",
          "amount": {
            "currency_code": "USD",
            "value": "230.00",
            "breakdown": {
              "item_total": {
                "currency_code": "USD",
                "value": "180.00"
              },
              "shipping": {
                "currency_code": "USD",
                "value": "30.00"
              },
              "handling": {
                "currency_code": "USD",
                "value": "10.00"
              },
              "tax_total": {
                "currency_code": "USD",
                "value": "20.00"
              },
              "shipping_discount": {
                "currency_code": "USD",
                "value": "10"
              }
            }
          },
          "items": [
            {
              "name": "T-Shirt",
              "description": "Green XL",
              "sku": "sku01",
              "unit_amount": {
                "currency_code": "USD",
                "value": "90.00"
              },
              "tax": {
                "currency_code": "USD",
                "value": "10.00"
              },
              "quantity": "1",
              "category": "PHYSICAL_GOODS"
            },
            {
              "name": "Shoes",
              "description": "Running, Size 10.5",
              "sku": "sku02",
              "unit_amount": {
                "currency_code": "USD",
                "value": "45.00"
              },
              "tax": {
                "currency_code": "USD",
                "value": "5.00"
              },
              "quantity": "2",
              "category": "PHYSICAL_GOODS"
            }
          ],
          "shipping": {
            "method": "United States Postal Service",
            "address": {
              "name": {
                "give_name":"John",
                "surname":"Doe"
              },
              "address_line_1": "123 Townsend St",
              "address_line_2": "Floor 6",
              "admin_area_2": "San Francisco",
              "admin_area_1": "CA",
              "postal_code": "94107",
              "country_code": "US"
            }
          }
        }
      ]
    }
    

    【讨论】:

      【解决方案2】:

      基本上,将这些细节放入&lt;script&gt; 的整个想法是错误的。它应该从一个服务器到另一个服务器,而 html 应该只反映参考代码。

      对于 PHP 用户,请查看

      use PayPalCheckoutSdk\Core\PayPalHttpClient;
      use PayPalCheckoutSdk\Core\PayPalEnvironment;
      use PayPalCheckoutSdk\Orders\OrdersCreateRequest;
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2013-01-07
        • 2014-02-08
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2017-04-17
        • 2011-05-16
        • 2019-05-26
        相关资源
        最近更新 更多