api - SetExpressCheckOut API问题

  显示原文与译文双语对照的内容
0 0

我正在尝试为SetExpressCheckout实现PayPal函数。 下面我将我的代码中的一部分用于在PayPal端调用付款过程。 一切看起来都不错。在最后一步的结帐中,我按下"立即付款"按钮和付款处理。 用户是returnet到我原来的站点,我得到交易 ID,成功消息和令牌。 它看起来像evrything完成了,但在我的PayPal帐户我没有看到任何交易,我根本没有得到任何钱。


 $returnUrl = home_url("/wp-login.php?checkemail=registered&ppayment=done&price=".$package_price."&code=".$paypal_price_unit."&package=".$package_name."&pid=".$incomingpost);


 $requestParams = array(
 'RETURNURL' => $returnUrl,
 'CANCELURL' => home_url('/wp-login.php?checkemail=registered&ppayment=cancel')
 );

//Sent item info
 $orderParams = array(
 'PAYMENTREQUEST_0_AMT' => $package_price,
 'PAYMENTREQUEST_0_SHIPPINGAMT' => '0',
 'PAYMENTREQUEST_0_CURRENCYCODE' => $paypal_price_unit,
 'PAYMENTREQUEST_0_ITEMAMT' => $package_price
 );

//send package info
 $item = array(
 'L_PAYMENTREQUEST_0_NAME0' => $paymentName,
 'L_PAYMENTREQUEST_0_DESC0' => $package_name,
 'L_PAYMENTREQUEST_0_AMT0' => $package_price,
 'L_PAYMENTREQUEST_0_QTY0' => '1'
 );


//Call payment process
 $infos = array();
 $infos['USER'] = $paypal_api_user;
 $infos['PWD'] = $paypal_api_pwd;
 $infos['SIGNATURE'] = $paypal_api_signature;
 if($paypal_sandbox == 1){$sandstatus = true;}else{$sandstatus = false;}



 $paypal = new Paypal($infos,$sandstatus);
 $response = $paypal -> request('SetExpressCheckout',$requestParams + $orderParams + $item);


 if(is_array($response) && $response['ACK'] == 'Success') { 
//We will redirecting now.
 $token = $response['TOKEN']; 

//Save DB before redirect.
 $trans_post = array(
 'post_status' => 'pending',
 'post_type' => 'retransactions',
 'post_title' => $token,
 );
 $new_post_id = wp_insert_post( $trans_post );
 add_post_meta($new_post_id, 'webburemap_payment_user', $user_id);
 add_post_meta($new_post_id, 'webburemap_payment_amount', $package_price);
 add_post_meta($new_post_id, 'webburemap_payment_package_id', $package_IDNO);
 add_post_meta($new_post_id, 'webburemap_payment_package_transtype', 'NewPackage');



 if($paypal_sandbox == 0){
 $commit = '&useraction=commit';
 header( 'Location: https://www.paypal.com/webscr?cmd=_express-checkout&token='. urlencode($token). $commit );//PayPal Pay Now
 }else{
 header( 'Location: https://www.sandbox.paypal.com/webscr?cmd=_express-checkout&token='. urlencode($token) );
 }
 die();
 }

时间: 原作者:

0 0

你可以提供Express签出令牌和要返回的事务 ID,我将在我的一边查看它可能发生的事情。 同时确保你指向正确的端点。 如果你正在尝试处理活动付款,请确保你指向现场的现场和 NOT 沙箱。

...