How to set mixture of recurring and one time payment in Paypal(如何在Paypal中设置定期付款和一次性付款的混合)
问题描述
我正在使用 Paypal REST API 对我的订阅收费.我的交易包括一次性购买和定期付款的混合.一次购买将收取用户金额 X,定期付款应创建定期配置文件,每年向用户收取金额 Y.
I'm using Paypal REST API to charge my subscriptions. My transaction includes a mixture of one-time purchase and recurring payment. One time purchase will charge a user amount X, and recurring payment should create recurring profile which will annually charge a user with amount Y.
这是我所拥有的.首先,我使用以下参数调用 SetExpressCheckoutPayment
:
Here is what I have. First I call SetExpressCheckoutPayment
with the following parameters:
$orderParams = array(
'PAYMENTREQUEST_0_AMT' => "10",
'PAYMENTREQUEST_0_CURRENCYCODE' => 'GBP',
'PAYMENTREQUEST_0_ITEMAMT' => "10",
'LOGOIMG'=>"http://mywebsite.com/a.jpg",
"MAXAMT"=>"100",
"NOSHIPPING"=>"1",
"ALLOWNOTE"=>"0",
"BRANDNAME"=>"My website",
"GIFTRECEIPTENABLE"=>"0",
"GIFTMESSAGEENABLE"=>"0"
);
$item = array(
'L_PAYMENTREQUEST_0_NAME0' => 'Subscription',
'L_PAYMENTREQUEST_0_DESC0' => 'Subscription bla bla bla',
'L_PAYMENTREQUEST_0_AMT0' => "10",
'L_PAYMENTREQUEST_0_QTY0' => '1',
);
$recurringPayment=array();
$recurringPayment=array(
"L_BILLINGTYPE0"=>"RecurringPayments",
"L_BILLINGAGREEMENTDESCRIPTION0"=>""
);
我在上面的代码中不知道如何设置定期付款的金额 Y 与一次性付款的金额 X 不同?
What I don't know in the code above is how to set amount Y for recurring payment which is different then amount X for one-time payment?
在执行 SetExpressCheckoutPayment
后,我执行 DoExpressCheckoutPayment
,然后使用以下参数调用 CreateRecurringPaymentsProfile
:
After SetExpressCheckoutPayment
is executed, I execute DoExpressCheckoutPayment
, and after that I call CreateRecurringPaymentsProfile
with the following arguments:
$requestParams=array(
"TOKEN"=>$token,
"PROFILESTARTDATE"=>date("Y-m-dTH:i:s"),
"DESC"=>"My Subscription",
"BILLINGPERIOD"=>"Year",
"BILLINGFREQUENCY"=>"1",
"AMT"=>"94",
"CURRENCYCODE"=>"GBP",
"L_PAYMENTREQUEST_0_ITEMCATEGORY0"=>"Digital",
"L_PAYMENTREQUEST_0_NAME0"=>"Subscription",
"L_PAYMENTREQUEST_0_AMT0"=>"10",
"L_PAYMENTREQUEST_0_QTY0"=>"1",
);
$response=$paypal->request("CreateRecurringPaymentsProfile",$requestParams);
创建了定期配置文件,但会向用户收取 X 的费用,我不希望这样.
Recurring profile is created, but will charge a user an amount X and I don't want that.
回复如下:来自 SetExpressCheckout
array (size=50)
'TOKEN' => string 'EC-0G8072749' (length=20)
'BILLINGAGREEMENTACCEPTEDSTATUS' => string '1' (length=1)
'CHECKOUTSTATUS' => string 'PaymentActionNotInitiated' (length=25)
'TIMESTAMP' => string '2014-09-23T16:57:24Z' (length=20)
'CORRELATIONID' => string 'c0b0e1a38cd36' (length=13)
'ACK' => string 'Success' (length=7)
'VERSION' => string '74.0' (length=4)
'BUILD' => string '12932421' (length=8)
'EMAIL' => string 'customer-sandbox@dwa.ca' (length=27)
'PAYERID' => string 'KKBJKUR86XT8L' (length=13)
'PAYERSTATUS' => string 'verified' (length=8)
'FIRSTNAME' => string 'John' (length=4)
'LASTNAME' => string 'Doe' (length=3)
'COUNTRYCODE' => string 'GB' (length=2)
'CURRENCYCODE' => string 'GBP' (length=3)
'AMT' => string '94.00' (length=5)
'ITEMAMT' => string '94.00' (length=5)
'SHIPPINGAMT' => string '0.00' (length=4)
'HANDLINGAMT' => string '0.00' (length=4)
'TAXAMT' => string '0.00' (length=4)
'INSURANCEAMT' => string '0.00' (length=4)
'SHIPDISCAMT' => string '0.00' (length=4)
'L_NAME0' => string 'My Subscription' (length=27)
'L_QTY0' => string '1' (length=1)
'L_TAXAMT0' => string '0.00' (length=4)
'L_AMT0' => string '94.00' (length=5)
'L_DESC0' => string 'My Subscription' (length=34)
'L_ITEMWEIGHTVALUE0' => string ' 0.00000' (length=10)
'L_ITEMLENGTHVALUE0' => string ' 0.00000' (length=10)
'L_ITEMWIDTHVALUE0' => string ' 0.00000' (length=10)
'L_ITEMHEIGHTVALUE0' => string ' 0.00000' (length=10)
'PAYMENTREQUEST_0_CURRENCYCODE' => string 'GBP' (length=3)
'PAYMENTREQUEST_0_AMT' => string '94.00' (length=5)
'PAYMENTREQUEST_0_ITEMAMT' => string '94.00' (length=5)
'PAYMENTREQUEST_0_SHIPPINGAMT' => string '0.00' (length=4)
'PAYMENTREQUEST_0_HANDLINGAMT' => string '0.00' (length=4)
'PAYMENTREQUEST_0_TAXAMT' => string '0.00' (length=4)
'PAYMENTREQUEST_0_INSURANCEAMT' => string '0.00' (length=4)
'PAYMENTREQUEST_0_SHIPDISCAMT' => string '0.00' (length=4)
'PAYMENTREQUEST_0_INSURANCEOPTIONOFFERED' => string 'false' (length=5)
'L_PAYMENTREQUEST_0_NAME0' => string 'My Subscription' (length=27)
'L_PAYMENTREQUEST_0_QTY0' => string '1' (length=1)
'L_PAYMENTREQUEST_0_TAXAMT0' => string '0.00' (length=4)
'L_PAYMENTREQUEST_0_AMT0' => string '94.00' (length=5)
'L_PAYMENTREQUEST_0_DESC0' => string 'My Subscription' (length=34)
'L_PAYMENTREQUEST_0_ITEMWEIGHTVALUE0' => string ' 0.00000' (length=10)
'L_PAYMENTREQUEST_0_ITEMLENGTHVALUE0' => string ' 0.00000' (length=10)
'L_PAYMENTREQUEST_0_ITEMWIDTHVALUE0' => string ' 0.00000' (length=10)
'L_PAYMENTREQUEST_0_ITEMHEIGHTVALUE0' => string ' 0.00000' (length=10)
'PAYMENTREQUESTINFO_0_ERRORCODE' => string '0' (length=1)
来自 GetExpressCheckoutDetails
的响应
array (size=25)
'TOKEN' => string 'EC-0G807275JM0847749' (length=20)
'SUCCESSPAGEREDIRECTREQUESTED' => string 'false' (length=5)
'TIMESTAMP' => string '2014-09-23T16:57:27Z' (length=20)
'CORRELATIONID' => string '5b9de22225c55' (length=13)
'ACK' => string 'Success' (length=7)
'VERSION' => string '74.0' (length=4)
'BUILD' => string '12932421' (length=8)
'INSURANCEOPTIONSELECTED' => string 'false' (length=5)
'SHIPPINGOPTIONISDEFAULT' => string 'false' (length=5)
'PAYMENTINFO_0_TRANSACTIONID' => string '1SV99367CG387745H' (length=17)
'PAYMENTINFO_0_TRANSACTIONTYPE' => string 'expresscheckout' (length=15)
'PAYMENTINFO_0_PAYMENTTYPE' => string 'instant' (length=7)
'PAYMENTINFO_0_ORDERTIME' => string '2014-09-23T16:57:26Z' (length=20)
'PAYMENTINFO_0_AMT' => string '94.00' (length=5)
'PAYMENTINFO_0_FEEAMT' => string '3.40' (length=4)
'PAYMENTINFO_0_TAXAMT' => string '0.00' (length=4)
'PAYMENTINFO_0_CURRENCYCODE' => string 'GBP' (length=3)
'PAYMENTINFO_0_PAYMENTSTATUS' => string 'Completed' (length=9)
'PAYMENTINFO_0_PENDINGREASON' => string 'None' (length=4)
'PAYMENTINFO_0_REASONCODE' => string 'None' (length=4)
'PAYMENTINFO_0_PROTECTIONELIGIBILITY' => string 'Ineligible' (length=10)
'PAYMENTINFO_0_PROTECTIONELIGIBILITYTYPE' => string 'None' (length=4)
'PAYMENTINFO_0_SECUREMERCHANTACCOUNTID' => string 'EW93XTSE5SR4G' (length=13)
'PAYMENTINFO_0_ERRORCODE' => string '0' (length=1)
'PAYMENTINFO_0_ACK' => string 'Success' (length=7)
来自 CreateRecurringPayment
array (size=9)
'TIMESTAMP' => string '2014-09-23T16:57:28Z' (length=20)
'CORRELATIONID' => string 'dd1f80a935b65' (length=13)
'ACK' => string 'Failure' (length=7)
'VERSION' => string '74.0' (length=4)
'BUILD' => string '12932421' (length=8)
'L_ERRORCODE0' => string '10004' (length=5)
'L_SHORTMESSAGE0' => string 'Cart item calculation mismatch.' (length=31)
'L_LONGMESSAGE0' => string 'Cart item calculation mismatch. The regular non-trial billing period amount is different than the sum of the amounts for each item in the cart.' (length=143)
'L_SEVERITYCODE0' => string 'Error' (length=5)
谢谢!
推荐答案
您必须在CreateRecurringPaymentsProfile"API 中指定的循环金额,您在SetExpressCheckoutPayment"和DoExpressCheckoutPayment"中设置的金额是一次性付款.
The recurring amount you have to specify in the "CreateRecurringPaymentsProfile " API , the amount you set in "SetExpressCheckoutPayment " and "DoExpressCheckoutPayment" is for one time time payment .
因此,经常性金额始终需要在CreateRecurringPaymentsProfile"API 中传递.
So ,recurring amount always needs to be passed in the "CreateRecurringPaymentsProfile" API .
这篇关于如何在Paypal中设置定期付款和一次性付款的混合的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何在Paypal中设置定期付款和一次性付款的混合
- 使用 GD 和 libjpeg 支持编译 PHP 2022-01-01
- PHP foreach() 与数组中的数组? 2022-01-01
- PHP - if 语句中的倒序 2021-01-01
- Laravel 5:Model.php 中的 MassAssignmentException 2021-01-01
- openssl_digest vs hash vs hash_hmac?盐与盐的区别HMAC? 2022-01-01
- 如何从数据库中获取数据以在 laravel 中查看页面? 2022-01-01
- Oracle 即时客户端 DYLD_LIBRARY_PATH 错误 2022-01-01
- 如何使用 Google API 在团队云端硬盘中创建文件夹? 2022-01-01
- 覆盖 Magento 社区模块控制器的问题 2022-01-01
- 如何在 Symfony2 中正确使用 webSockets 2021-01-01