问题描述
我正在使用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-d\TH:i:s\Z"),
"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 '[email protected]' (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中设定定期付款和一次性付款的混合的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!