2012-09-02 4 views
0

PHP로 PayPal Express Checkout을 만들려고합니다.PayPal Express Checkout이 PHP와 호환되지 않습니다

<form action='/paypal/expresscheckout.php' METHOD='POST'> 
     <input type='image' name='submit' src='https://www.paypal.com/en_US/i/btn/btn_xpressCheckout.gif' border='0' align='top' alt='Check out with PayPal'/> 
    </form> 

여기는 페이팔 화면으로 리디렉션되기 전에 버튼입니다.

<?php 

require_once ("paypalfunctions.php"); 
// ================================== 
// PayPal Express Checkout Module 
// ================================== 

//'------------------------------------ 
//' The paymentAmount is the total value of 
//' the shopping cart, that was set 
//' earlier in a session variable 
//' by the shopping cart page 
//'------------------------------------ 
//$paymentAmount = $_SESSION["Payment_Amount"]; 
$paymentAmount = '1'; 

//'------------------------------------ 
//' The currencyCodeType and paymentType 
//' are set to the selections made on the Integration Assistant 
//'------------------------------------ 
$currencyCodeType = "USD"; 
$paymentType = "Sale"; 

//'------------------------------------ 
//' The returnURL is the location where buyers return to when a 
//' payment has been succesfully authorized. 
//' 
//' This is set to the value entered on the Integration Assistant 
//'------------------------------------ 
$returnURL = "http://www.mydomain.com/add_funds/order_confirm"; 

//'------------------------------------ 
//' The cancelURL is the location buyers are sent to when they hit the 
//' cancel button during authorization of payment during the PayPal flow 
//' 
//' This is set to the value entered on the Integration Assistant 
//'------------------------------------ 
$cancelURL = "http://www.mydomain.com/add_funds/order_cancel"; 

//'------------------------------------ 
//' Calls the SetExpressCheckout API call 
//' 
//' The CallShortcutExpressCheckout function is defined in the file PayPalFunctions.php, 
//' it is included at the top of this file. 
//'------------------------------------------------- 
$resArray = CallShortcutExpressCheckout ($paymentAmount, $currencyCodeType, $paymentType, $returnURL, $cancelURL); 
$ack = strtoupper($resArray["ACK"]); 
if($ack=="SUCCESS" || $ack=="SUCCESSWITHWARNING") 
{ 
    RedirectToPayPal ($resArray["TOKEN"]); 
} 
else 
{ 
    //Display a user friendly Error on the page using any of the following error information returned by PayPal 
    $ErrorCode = urldecode($resArray["L_ERRORCODE0"]); 
    $ErrorShortMsg = urldecode($resArray["L_SHORTMESSAGE0"]); 
    $ErrorLongMsg = urldecode($resArray["L_LONGMESSAGE0"]); 
    $ErrorSeverityCode = urldecode($resArray["L_SEVERITYCODE0"]); 

    echo "SetExpressCheckout API call failed. "; 
    echo "Detailed Error Message: " . $ErrorLongMsg; 
    echo "Short Error Message: " . $ErrorShortMsg; 
    echo "Error Code: " . $ErrorCode; 
    echo "Error Severity Code: " . $ErrorSeverityCode; 
} 
?> 

이 내가 페이팔 버튼을 누르면 후, 나는 어떤 순서 정보없이이 화면을 볼 수 있습니다 특급 expresscheckout.php 코드

enter image description here

입니다.

코드에 지불하기 위해 1 달러를 지불했지만 주문 요약에는 아무 것도 말하지 않습니다.

어쨌든, 나는이 거래를 진행하기 위해 다른 PayPal 계정을 넣었습니다.

enter image description here

내 배송 주소와 개인 정보를 볼 수 있습니다.

그러나 아직 주문 요약 정보가 없습니다.

$ 1 달러를 지불해야합니다. I 버튼을 계속 클릭하면

, 그것은 "returnURL"

당신은 문제가 무엇인지 아십니까하는 페이지를 리디렉션? 대신 https://www.paypal.com/cgi-bin/webcsr?cmd=_express-checkout&token=EC-xxxxxx로 리디렉션의

+0

좀 더 정보가 도움이 될 수 커밋 .. . –

+0

@KevinWang 나는 expresscheckout 코드를 넣었다. – Jake

답변

1

는 '주문 요약'섹션에 달러 값을 추가합니다 https://www.paypal.com/cgi-bin/webcsr?cmd=_express-checkout&token=EC-xxxxxx&useraction=commit

이로 리디렉션하고, '지금 결제'로 최종 검토 페이지에서 '계속'버튼을 변경합니다.
후자를 원하지 않으면 대신 줄 항목 세부 정보를 보내야합니다.
자세한 내용은 https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_api_ECCustomizing을 참조하십시오. 나는 그것이 약간, 내가 대신 사용 변경 있지만 그것을 게시

관련 문제