我使用Paypal Express Checkout设置定期付款。我被阻止的问题是我无法弄清楚如何将开始日期从我的网站一直传递到CreateRecurringPaymentsProfile
函数。 $_SESSION
无法正常工作,因此我查看了API,您可以在SetExpressCheckout
中设置一个名为PAYMENTREQUEST_n_CUSTOM
的字段,但仅适用于包括直接付款和不再发生在内的交易。任何人都可以帮我这个吗?
function CallShortcutExpressCheckout( $paymentAmount, $currencyCodeType, $paymentType, $returnURL, $cancelURL, $paymentStartdate)
{
$nvpstr="&AMT=". $paymentAmount;
$nvpstr .= "&PAYMENTACTION=" . $paymentType;
$nvpstr .= "&BILLINGAGREEMENTDESCRIPTION=".urlencode("Denise Austin 360 Weekly Payments");
$nvpstr .= "&BILLINGTYPE=RecurringPayments";
$nvpstr .= "&RETURNURL=" . $returnURL;
$nvpstr .= "&CANCELURL=" . $cancelURL;
$nvpstr .= "&CURRENCYCODE=" . $currencyCodeType;
$nvpstr .= "&PROFILESTARTDATE=" . urlencode($paymentStartdate);
$nvpstr .= "&PAYMENTREQUEST_0_NOTETEXT=". urlencode($paymentStartdate);
$_SESSION["currencyCodeType"] = $currencyCodeType;
$_SESSION["PaymentType"] = $paymentType;
$_SESSION["startdate"] = $paymentStartdate;
$resArray=hash_call("SetExpressCheckout", $nvpstr);
$ack = strtoupper($resArray["ACK"]);
if($ack=="SUCCESS" || $ack=="SUCCESSWITHWARNING")
{
$token = urldecode($resArray["TOKEN"]);
$_SESSION['TOKEN']=$token;
}
return $resArray;
}
正如你所看到我试图在PAYMENTREQUEST_0_NOTETEXT字段中传递startdate但是当我进入订单确认部分并且我调用$ GetExpressCheckoutDetails($ token)时,所有返回的是:
Array
(
[TOKEN] => EC-6JB06756S20069824
[BILLINGAGREEMENTACCEPTEDSTATUS] => 1
[CHECKOUTSTATUS] => PaymentActionNotInitiated
[TIMESTAMP] => 2014-11-22T23:58:03Z
[CORRELATIONID] => cfd8d79420c2f
[ACK] => Success
[VERSION] => 84
[BUILD] => 13630372
[EMAIL] => xxxxxxxxxxxxxxxx
[PAYERID] => xxxxxxxxxxxxxx
[PAYERSTATUS] => verified
[FIRSTNAME] => Test
[LASTNAME] => Buyer
[COUNTRYCODE] => US
[SHIPTONAME] => Test Buyer
[SHIPTOSTREET] => xxxxxxxx
[SHIPTOCITY] => xxxxxxxx
[SHIPTOSTATE] => CA
[SHIPTOZIP] => xxxxxxx
[SHIPTOCOUNTRYCODE] => US
[SHIPTOCOUNTRYNAME] => United States
[ADDRESSSTATUS] => Confirmed
[CURRENCYCODE] => USD
[AMT] => 14.99
[SHIPPINGAMT] => 0.00
[HANDLINGAMT] => 0.00
[TAXAMT] => 0.00
[INSURANCEAMT] => 0.00
[SHIPDISCAMT] => 0.00
[PAYMENTREQUEST_0_CURRENCYCODE] => USD
[PAYMENTREQUEST_0_AMT] => 14.99
[PAYMENTREQUEST_0_SHIPPINGAMT] => 0.00
[PAYMENTREQUEST_0_HANDLINGAMT] => 0.00
[PAYMENTREQUEST_0_TAXAMT] => 0.00
[PAYMENTREQUEST_0_INSURANCEAMT] => 0.00
[PAYMENTREQUEST_0_SHIPDISCAMT] => 0.00
[PAYMENTREQUEST_0_INSURANCEOPTIONOFFERED] => false
[PAYMENTREQUEST_0_SHIPTONAME] => Test Buyer
[PAYMENTREQUEST_0_SHIPTOSTREET] => xxxxxxxxxx
[PAYMENTREQUEST_0_SHIPTOCITY] => xxxxxxxxxx
[PAYMENTREQUEST_0_SHIPTOSTATE] => CA
[PAYMENTREQUEST_0_SHIPTOZIP] => xxxxxxxxx
[PAYMENTREQUEST_0_SHIPTOCOUNTRYCODE] => US
[PAYMENTREQUEST_0_SHIPTOCOUNTRYNAME] => United States
[PAYMENTREQUEST_0_ADDRESSSTATUS] => Confirmed
[PAYMENTREQUESTINFO_0_ERRORCODE] => 0
)