我使用Paypal REST API为我的订阅付费。 我的交易包括一次性购买和定期付款的混合。一次性购买将向用户收取金额X,并且定期付款应创建重复的个人资料,每年向用户收取金额Y.
这就是我所拥有的。首先,我使用以下参数调用SetExpressCheckoutPayment
:
$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不同?
执行SetExpressCheckoutPayment
后,执行DoExpressCheckoutPayment
,然后使用以下参数调用CreateRecurringPaymentsProfile
:
$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而我不想要这样做。
以下是回复:
来自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)
THX!
答案 0 :(得分:1)
您必须在" CreateRecurringPaymentsProfile"中指定的经常性金额; API,您设置的金额" SetExpressCheckoutPayment"和#34; DoExpressCheckoutPayment"是一次性付款。
因此,经常需要在" CreateRecurringPaymentsProfile"中传递经常性金额。 API。