Online Book Reader

Home Category

PayPal APIs_ Up and Running_ A Developer's Guide - Michael Balderas [21]

By Root 163 0
to pay with a

// currency other than the non-primary

// currency, the conversion occurs

// in the customer's account.

/*

'Status of the payment:

'Completed: The payment has been completed, and the funds have been added

'successfully to your account balance.

'Pending: The payment is pending. See the PendingReason element for more information.

*/

$paymentStatus = $resArray["PAYMENTSTATUS"];

/*

'The reason the payment is pending:

' none: No pending reason.

' address: The payment is pending because your customer did not include a

' confirmed shipping address and your Payment Receiving Preferences

' is set such that you want to manually accept or deny each of these

' payments. To change your preference, go to the Preferences section

' of your Profile.

' echeck: The payment is pending because it was made by an eCheck that has

' not yet cleared.

' intl: The payment is pending because you hold a non-U.S. account and

' do not have a withdrawal mechanism. You must manually accept or

' deny this payment from your Account Overview.

' multi-currency: You do not have a balance in the currency sent,

' and you do not have your Payment Receiving

' Preferences set to automatically convert and

' accept this payment. You must manually accept

' or deny this payment.

' verify: The payment is pending because you are not yet verified.

' You must verify your account before you can accept this payment.

' other: The payment is pending for a reason other than those listed above.

' For more information, contact PayPal customer service.

*/

$pendingReason = $resArray["PENDINGREASON"];

/*

'The reason for a reversal if TransactionType is reversal:

' none: No reason code.

' chargeback: A reversal has occurred on this transaction due to a

' chargeback by your customer.

' guarantee: A reversal has occurred on this transaction due to

' your customer triggering a money-back guarantee.

' buyer-complaint: A reversal has occurred on this transaction

' due to a complaint about the transaction

' from your customer.

' refund: A reversal has occurred on this transaction because

' you have given the customer a refund.

' other: A reversal has occurred on this transaction due to

' a reason not listed above.

*/

$reasonCode = $resArray["REASONCODE"];

}

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 "GetExpressCheckoutDetails API call failed. ";

echo "Detailed Error Message: " . $ErrorLongMsg;

echo "Short Error Message: " . $ErrorShortMsg;

echo "Error Code: " . $ErrorCode;

echo "Error Severity Code: " . $ErrorSeverityCode;

}

}

?>

Example 2-6. shoppingcart.php

src='https://www.paypal.com/en_US/i/btn/btn_xpressCheckout.gif'

border='0' align='top' alt='Check out with PayPal'/>

Chapter 3. PayPal Website Payments Pro


PayPal’s Website Payments Pro allows you API access to two components: Express Checkout (covered in Chapter 2) and Direct Payment. Direct Payment allows you to accept debit and credit cards directly from your site. Direct Payment, unlike Express Pay, requires the buyer to enter payment, billing, and shipping information, and does not require the buyer to have a PayPal Account. In addition, Website Payments Pro accounts do not show up as “PayPal” on your customer’s credit card statements: your company’s name shows up instead.

Overview of Direct Payment


Direct Payment allows your customers to pay via credit or debit cards during your checkout flow. This gives the seller complete control over the buyer’s transaction experience. When a buyer chooses to pay with a credit or debit card, he enters his card number and other information directly on your site. This arrangement makes

Return Main Page Previous Page Next Page

®Online Book Reader