Paypal Randomly Sometimes charging twice to my customers
nasirzia
Contributor
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Posted on
Jul-30-2020
12:27 AM
Hi, I am using paypal website payment pro on my website, the payment code I use was the one I copied from paypal's official website.
Some of my users are being charged twice, however in CRM there is only one entry (which obviously means our code executes once only). I can't figure out, why randomly some of my visitors are being charged twice..
I am attaching the following source code to let you guys have an idea about the code..
$f_name = $_POST['FIRSTNAME'];
$l_name = $_POST['LASTNAME'];
$street = $_POST['STREET'];
$city = $_POST['CITY'];
$state = $_POST['STATE'];
$ZIP = $_POST['ZIP'];
$title = $_POST['title'];
$email = $_POST['email'];
$perm = $_POST['perm'];
$gift_aid = $_POST['gift_aid'];
if($gift_aid == '1'){
$gift_aid = 'true';
}else{
$gift_aid = 'false';
}
if($street == ''){
$street = 'N/A';
}
if($city == ''){
$city = 'N/A';
}
if($ZIP == ''){
$ZIP = '0000';
}
$fulladdress = $_POST['fulladdress'];
$data = 'VERSION=56.0&';
$data .= 'SIGNATURE=AFK.XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
$data .= '&';
$data .= 'USER=XXXXXXXmyemailaddressXXXXXX';
$data .= '&';
$data .= 'PWD=XXXXXXXXXX';
$data .= '&';
$data .= 'METHOD=DoDirectPayment';
$data .= '&';
$data .= 'PAYMENTACTION=Sale';
$data .= '&';
$data .= 'IPADDRESS='.$_IP;
$data .= '&';
$data .= 'AMT='.$AMT;
$data .= '&';
$data .= 'CURRENCYCODE=GBP';
$data .= '&';
$data .= 'ACCT='.$ACCT;
$data .= '&';
$data .= 'EXPDATE='.$exp_year;
$data .= '&';
$data .= 'CVV2='.$CVV2;
$data .= '&';
$data .= 'FIRSTNAME='.$f_name;
$data .= '&';
$data .= 'LASTNAME='.$l_name;
$data .= '&';
$data .= 'STREET='.$street;
$data .= '&';
$data .= 'CITY='.$city;
$data .= '&';
$data .= 'STATE='.$state;
$data .= '&';
$data .= 'ZIP='.$ZIP;
$data .= '&';
$data .= 'COUNTRYCODE=US';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api-3t.paypal.com/nvp');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$headers = array();
$headers[] = 'Content-Type: application/x-www-form-urlencoded';
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$result = curl_exec($ch);
if (curl_errno($ch)) {
echo 'Error:' . curl_error($ch);
}
curl_close($ch);
0 REPLIES 0
Haven't Found your Answer?
It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.
Related Content
- Something doesn't look right. Your payment to this merchant can't be completed using PayPal. in Sandbox Environment
- Using Paypal Smart Buttons for checkout sometimes fails with Debit/ Credit Cards Form in Braintree Client-side Integration (JS, iOS, Android SDKs)
- Need help to integrate PayPal Checkout with Ecwid in PayPal Upgrade Community
- Buy Now button in the sandbox - no customer confirmation email in Sandbox Environment
- Mandatory Account Creation Hindering Customer Experience in REST APIs