我正试图获得折扣,以申请我写的购物车。我正在使用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' )
}
};
..甚至在最初的支付电话中尝试过 - 但似乎都没有认出折扣(并应用它)。
'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
奇怪的是 - 折扣正在应用......只是没有显示???
答案 0 :(得分:1)
我很好奇你在哪里看到"折扣"参数甚至在这些调用中可用.. ??它未列在Pay或SetPaymentOptions的API参考中。
您需要做的是在SetPaymentOptions中将折扣添加为负数金额的订单项。因此,它将是一个额外的行项目,其值为-0.15。你可以命名这个项目"折扣"或者你想要的任何东西,但同样,这些API中没有实际的折扣参数。