0% found this document useful (0 votes)
362 views

Paypal

This document contains code for processing a credit card payment through PayPal's Payflow system. It retrieves payment details entered by the user, including credit card number and expiration date. It then calls the DirectPayment API, passing these details along with other order information. The response is checked for errors, and error codes or messages will be displayed to the user if the payment fails.

Uploaded by

a.shyam
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
362 views

Paypal

This document contains code for processing a credit card payment through PayPal's Payflow system. It retrieves payment details entered by the user, including credit card number and expiration date. It then calls the DirectPayment API, passing these details along with other order information. The response is checked for errors, and error codes or messages will be displayed to the user if the payment fails.

Uploaded by

a.shyam
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

/*

==================================================================
Payflow Credit Card - ORDER CONFIRM : START SNIPPET
===================================================================
*/
if (PaymentOption == "Visa" || PaymentOption == "MasterCard" || PaymentOption ==
"Amex" || PaymentOption = "Discover")
{
/*
'------------------------------------
' The paymentAmount is the total value of
' the shopping cart, that was set
' earlier in a session variable
' by the shopping cart page
'------------------------------------
*/
String paymentAmount = (String)session.getAttribute("Payment_Amount");
/*
'------------------------------------
' The paymentType that was selected earlier
'------------------------------------
*/
String paymentType = "Authorization";
/*
' Set these values based on what was selected by the user on the Billing
page Html form
*/
String creditCardType = "<<Visa/MasterCard/Amex/Discover>>"; /
/' Set this to one of the acceptable values (Visa/MasterCard/Amex/Discover) matc
h it to what was selected on your Billing page
String creditCardNumber = "<<CC number>>"; // ' Set this to the
string entered as the credit card number on the Billing page
String expDate = "<<Expiry Date>>"; // ' Set th
is to the credit card expiry date entered on the Billing page
String cvv2 = "<<cvv2>>"; // ' Set this to t
he CVV2 string entered on the Billing page
String firstName = "<<firstName>>"; // ' Set this
to the customer's first name that was entered on the Billing page
String lastName = "<<lastName>>"; // ' Set this
to the customer's last name that was entered on the Billing page
String street = "<<street>>"; // ' Set this to
the customer's street address that was entered on the Billing page
String city = "<<city>>"; // ' Set this to t
he customer's city that was entered on the Billing page
String state = "<<state>>"; // ' Set this to
the customer's state that was entered on the Billing page
String zip = "<<zip>>"; // ' Set th
is to the zip code of the customer's address that was entered on the Billing pag
e
String countryCode = "<<PayPal Country Code>>"; //
' Set this to the PayPal code for the Country of the customer's address that was
entered on the Billing page
String currencyCode = "<<PayPal Currency Code>>"; // ' Set t
his to the PayPal code for the Currency used by the customer
String orderDescription = "<<OrderDescription>>"; // ' Set this
to the textual description of this order
/*
'------------------------------------------------
' Calls the DoDirectPayment API call
'
' The DirectPayment function is defined in PayPalFunctions.java
' included at the top of this file.
'-------------------------------------------------
*/
nvp = DirectPayment ( paymentType, paymentAmount, creditCardType, credit
CardNumber,
expDate, cvv2, firstName, lastName, street, city, state, zip,
countryCode, currencyCode, orderDescription );
String strAck = nvp.get("RESULT").toString();
if(strAck ==null || !strAck.equalsIgnoreCase("0"))
{
//Display a user friendly Error on the page using any of the fol
lowing error information returned by Payflow
// See pages 50 through 65 in https://cms.paypal.com/cms_content
/US/en_US/files/developer/PP_PayflowPro_Guide.pdf for a list of RESULT values (e
rror codes)
String ErrorCode = strAck;
String ErrorMsg = nvp.get("RESPMSG").toString();
}
}

You might also like