PayPal API - 折扣?

标签 paypal paypal-adaptive-payments

我正在尝试获得折扣以应用于我编写的购物车。我正在使用 Adaptive API 系统,但我似乎无法正确使用它。我在 SetPaymentOptions 调用中尝试过:

      'receiverOptions' => [
                             {
                               'receiver' => {
                                               'email' => 'foo@live.co.uk'
                                             },
                               'invoiceData' => {
                                                  'totalShipping' => '8.00',
                                                  'totalTax' => 0,
                                                  'item' => [
                                                              {
                                                                'itemPrice' => '15.00',
                                                                'name' => 'Alice in Wonderland Mechanism Necklace',
                                                                'price' => '15',
                                                                'itemCount' => 1
                                                              },
                                                              {
                                                                'itemPrice' => '30.00',
                                                                'name' => '110 Year Old Unicorn Dial Necklace',
                                                                'price' => '30',
                                                                'itemCount' => 1
                                                              }
                                                            ],
                                                  'discount' => '0.15'
                                                }
                             }
                           ],
      'requestEnvelope' => {
                             'errorLanguage' => 'en_US',
                             'detailLevel' => 'ReturnAll'
                           },
      'payKey' => 'AP-2F6415163M814733M',
      'SenderOptions' => {
                           'requireShippingAddressSelection' => bless( do{\(my $o = 1)}, 'JSON::XS::Boolean' )
                         }
    };

..甚至在最初的Pay 通话中尝试过 - 但似乎都没有识别折扣(并应用)。

     'currencyCode' => 'GBP',
      'requestEnvelope' => {
                             'errorLanguage' => 'en_US',
                             'detailLevel' => 'ReturnAll'
                           },
      'cancelUrl' => 'https://sitedev.net/',
      'discount' => '0.15',
      'actionType' => 'CREATE',
      'ipnNotificationUrl' => 'https://sitedev.net/cgi-bin/ipn.cgi',
      'returnUrl' => 'https://sitedev.net/myorders',
      'reverseAllParallelPaymentsOnError' => bless( do{\(my $o = 0)}, 'JSON::XS::Boolean' ),
      'receiverList' => {
                          'receiver' => [
                                          {
                                            'email' => 'foo@live.co.uk',
                                            'amount' => '53.00',
                                            'invoiceId' => '47',
                                            'paymentType' => 'GOODS'
                                          }
                                        ]
                        }
    };

更新:嗯好的 - 仍然有问题!

                         'item' => [
                                     {
                                       'itemPrice' => '25.00',
                                       'name' => 'Cryptex - 16Gb USB Drive',
                                       'price' => '25',
                                       'itemCount' => 1
                                     },
                                     {
                                       'name' => 'Special Discount',
                                       'price' => '-2.50',
                                       'itemCount' => 1
                                     },
                                     {
                                       'itemPrice' => '5.00',
                                       'name' => 'Shipping',
                                       'price' => '5.00',
                                       'itemCount' => 1
                                     }
                                   ]

这就是我传递的值,但在购物车末端,它显示为:

 Steampunk Junkies £27.50
 Cryptex - 16Gb USB Drive
 £25.00
 Shipping
 £5.00

 £0.00

奇怪的是 - 正在应用折扣...只是没有显示???

最佳答案

我很好奇您在哪里看到在这些调用中甚至可以使用“折扣”参数……??它未在 Pay 的 API 引用中列出或 SetPaymentOptions .

您需要做的是在 SetPaymentOptions 中将折扣添加为订单项,金额为负数。因此,这将是一个额外的订单项,其值为 -0.15。您可以将项目命名为“折扣”或任何您想要的名称,但同样,这些 API 中没有可用的实际折扣参数。

关于PayPal API - 折扣?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26817580/

相关文章:

rest - Paypal REST API : trying to activate a billing plan, 但得到 "HTTP/1.1 401 Unauthorized"

android - 如何在android中的paypal并行支付中隐藏收款人信息?

c# - Paypal payKey 将我带到错误的付款

php - Paypal PHP SDK : Fatal error: Uncaught Error: Class 'Paypal\Rest\ApiContext' not found

paypal - 我在哪里可以在沙盒中的个人验证帐户上找到 "My preapproved payments"

Paypal 没有覆盖返回 URL?

php - PayPal Express Checkout 项目名称和编号

paypal - 使用 Paypal Adaptive Payments API for Mobile Web 是正确的选择吗?

laravel - 在 Paypal 快速结帐客户端休息中有错误请求

javascript - 在灯箱中加载 Paypal 上下文结帐,几秒钟后恢复为经典快速结帐