Support A2Billing :

provided by Star2Billing S.L.

Support A2Billing :
It is currently Sat Apr 27, 2024 5:22 am
Hosted Voice Broadcast


All times are UTC




Post new topic Reply to topic  [ 11 posts ] 
Author Message
 Post subject: how do i intigrate paypal?
PostPosted: Thu Apr 19, 2007 1:02 pm 
Offline

Joined: Mon Apr 09, 2007 7:18 pm
Posts: 43
I have a paypal business account
how do i go about putting it to work?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 19, 2007 3:27 pm 
Offline

Joined: Thu Aug 10, 2006 10:47 pm
Posts: 145
Location: LA,CA,USA
Just add the relevant account information to the a2billing.conf


Top
 Profile  
 
 Post subject:
PostPosted: Sat Apr 28, 2007 4:43 am 
Offline

Joined: Mon Apr 09, 2007 7:18 pm
Posts: 43
payments do not get posted to account but does show up in my paypal


Top
 Profile  
 
 Post subject:
PostPosted: Sat Apr 28, 2007 10:52 am 
Offline

Joined: Fri Apr 28, 2006 5:11 am
Posts: 426
use search on the forum. this question was here already many many times.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Apr 28, 2007 2:54 pm 
Offline

Joined: Mon Apr 09, 2007 7:18 pm
Posts: 43
Its still not working

I have made sure that port 440-450 are pointing to the server

I have made sure that auto return is turned on ,, i point it to
http://domain/a2customer/index2.php -- correct me if its wrong

made sure payment data transfer is turned on
made sure that instant payment notification is on and pointing to correct url

conf file is pointing to
notify_url=http://domain/a2billing/paypal/ipn_res.php

log shows
[Sat Apr 28 10:21:00 EDT 2007] paypay_ipn notification

Bad order (PayPal says it's invalid)HTTP/1.1 200 OK^M
Date: Sat, 28 Apr 2007 14:21:00 GMT^M
Server: Apache/1.3.33 (Unix) mod_fastcgi/2.4.2 mod_gzip/1.3.26.1a mod_ssl/2.8.22 OpenSSL/0.9.7e^M
Set-Cookie: cookie_check=yes; expires=Tue, 25-Apr-2017 14:21:00 GMT; path=/; domain=.paypal.com^M
Set-Cookie: Apache=208.120.39.210.136911177770060222; path=/; expires=Mon, 20-Apr-37 14:21:00 GMT^M
Connection: close^M
Content-Type: text/html; charset=UTF-8^M
^M
INVALID

The following data was received from PayPal:


Top
 Profile  
 
 Post subject:
PostPosted: Sat Apr 28, 2007 3:30 pm 
Offline

Joined: Fri Apr 28, 2006 5:11 am
Posts: 426
Quote:
Bad order (PayPal says it's invalid)HTTP/1.1 200 OK^M

Quote:
INVALID

So, you want what A2B will make payment anyway, when paypal is not allowed the transaction? 8)


Top
 Profile  
 
 Post subject:
PostPosted: Sat Apr 28, 2007 3:42 pm 
Offline

Joined: Mon Apr 09, 2007 7:18 pm
Posts: 43
ahh, i found a typo in email field
corrected that,,
at this point i do not know what to use for return url

i get
Sorry, you don t have access to this page !
when using http://domain/a2customer/index2.php

payment still does not get posted to account


Top
 Profile  
 
 Post subject:
PostPosted: Sat Apr 28, 2007 4:00 pm 
Offline

Joined: Fri Apr 28, 2006 5:11 am
Posts: 426
that's right! you need to log in as customer first! after make payment (from A2B!!!!) and after payment done you will come back to customer interface...


Top
 Profile  
 
 Post subject:
PostPosted: Sun Apr 29, 2007 12:16 am 
Offline

Joined: Mon Apr 09, 2007 7:18 pm
Posts: 43
Actually i did

So what I did is

log in as a customer
make a payment

paypal does not direct me back, it goes to an error page

customer does not get credited


Top
 Profile  
 
 Post subject:
PostPosted: Sun Apr 29, 2007 3:27 pm 
Offline

Joined: Mon Apr 09, 2007 7:18 pm
Posts: 43
Got it to work

notify_url on conf file did not match the one in paypal

Added after 47 minutes:

Now i get the weird things

payment get posted 3 times

so if someone pay $1 , he gets credited 3 times as much

log shows transaction with same id 3 times



[Sun Apr 29 12:16:17 EDT 2007] Get a request -

payer_id , payment_date , txn_id , first_name , last_name , payer_email , payer_status , payment_type , memo , item_name , item_number , quantity , mc_gross , mc_currency , address_name , address_street , address_city , address_state , address_zip , address_country , address_status , payer_business_name , payment_status , pending_reason , reason_code , txn_type

[Sun Apr 29 12:16:17 EDT 2007] paypay_ipn notification

This was a successful transaction

The following data was received from PayPal:

payment_date: 09:15:52 Apr 29, 2007 PDT
txn_type: web_accept
last_name: *
residence_country: US
item_name: Calling Card Purchase
payment_gross: 1.00
mc_currency: USD
business: *@gmail.com
payment_type: instant
verify_sign: AGs52InFHk3cJ5j80u2Udq.A26J4AsfhZL0SJmh4kJ9.oKbp01e3bKh0
payer_status: verified
tax: 0.00
payer_email: *@gmail.com
txn_id: 04G8356990735322C
quantity: 1
receiver_email: *@gmail.com
first_name: *
payer_id: KG7QAXZJ8Y4PC
receiver_id: EHQW6UCUAQLF4
item_number: 0738570225
payment_status: Completed
payment_fee: 0.33
mc_fee: 0.33
shipping: 0.00
mc_gross: 1.00
custom:
charset: windows-1252
notify_version: 2.1


[Sun Apr 29 12:16:49 EDT 2007] Get a request -

payer_id , payment_date , txn_id , first_name , last_name , payer_email , payer_status , payment_type , memo , item_name , item_number , quantity , mc_gross , mc_currency , address_name , address_street , address_city , address_state , address_zip , address_country , address_status , payer_business_name , payment_status , pending_reason , reason_code , txn_type

[Sun Apr 29 12:16:49 EDT 2007] paypay_ipn notification

[item_number:0738570225] - This was a duplicate transaction or wrong sql (cc_paypal -> payer_id , payment_date , txn_id , first_name , last_name , payer_email , payer_status , payment_type , memo , item_name , item_number , quantity , mc_gross , mc_fee , tax , mc_currency , address_name , address_street , address_city , address_state , address_zip , address_country , address_status , payer_business_name , payment_status , pending_reason , reason_code , txn_type|'KG7QAXZJ8Y4PC', '09:15:52 Apr 29, 2007 PDT', '04G8356990735322C', '*', '*', '*@gmail.com', 'verified', 'instant', '', 'Calling Card Purchase', '0738570225', 1, 1.00, 0.33, 0.00, 'USD', '', '', '', '', '', '', '', '', 'Completed', '', '', 'web_accept') error:Could not create a new instance in the table 'cc_paypal'

The following data was received from PayPal:

payment_date: 09:15:52 Apr 29, 2007 PDT
txn_type: web_accept
last_name: *
residence_country: US
item_name: Calling Card Purchase
payment_gross: 1.00
mc_currency: USD
business: *@gmail.com
payment_type: instant
verify_sign: AGs52InFHk3cJ5j80u2Udq.A26J4AsfhZL0SJmh4kJ9.oKbp01e3bKh0
payer_status: verified
tax: 0.00
payer_email: *@gmail.com
txn_id: 04G8356990735322C
quantity: 1
receiver_email: *@gmail.com
first_name: *
payer_id: KG7QAXZJ8Y4PC
receiver_id: EHQW6UCUAQLF4
item_number: 0738570225
payment_status: Completed
payment_fee: 0.33
mc_fee: 0.33
shipping: 0.00
mc_gross: 1.00
custom:
charset: windows-1252
notify_version: 2.1


[Sun Apr 29 12:17:31 EDT 2007] Get a request -

payer_id , payment_date , txn_id , first_name , last_name , payer_email , payer_status , payment_type , memo , item_name , item_number , quantity , mc_gross , mc_currency , address_name , address_street , address_city , address_state , address_zip , address_country , address_status , payer_business_name , payment_status , pending_reason , reason_code , txn_type

[Sun Apr 29 12:17:31 EDT 2007] paypay_ipn notification

[item_number:0738570225] - This was a duplicate transaction or wrong sql (cc_paypal -> payer_id , payment_date , txn_id , first_name , last_name , payer_email , payer_status , payment_type , memo , item_name , item_number , quantity , mc_gross , mc_fee , tax , mc_currency , address_name , address_street , address_city , address_state , address_zip , address_country , address_status , payer_business_name , payment_status , pending_reason , reason_code , txn_type|'KG7QAXZJ8Y4PC', '09:15:52 Apr 29, 2007 PDT', '04G8356990735322C', '*', '*', '', 'verified', 'instant', '', 'Calling Card Purchase', '0738570225', 1, 1.00, 0.33, 0.00, 'USD', '', '', '', '', '', '', '', '', 'Completed', '', '', 'web_accept') error:Could not create a new instance in the table 'cc_paypal'

The following data was received from PayPal:

payment_date: 09:15:52 Apr 29, 2007 PDT
txn_type: web_accept
last_name: *
residence_country: US
item_name: Calling Card Purchase
payment_gross: 1.00
mc_currency: USD
business: *@gmail.com
payment_type: instant
verify_sign: AGs52InFHk3cJ5j80u2Udq.A26J4AsfhZL0SJmh4kJ9.oKbp01e3bKh0
payer_status: verified
tax: 0.00
payer_email: *@gmail.com
txn_id: 04G8356990735322C
quantity: 1
receiver_email: *@gmail.com
first_name: *
payer_id: KG7QAXZJ8Y4PC
receiver_id: EHQW6UCUAQLF4
item_number: 0738570225
payment_status: Completed
payment_fee: 0.33
mc_fee: 0.33
shipping: 0.00
mc_gross: 1.00
custom:
charset: windows-1252
notify_version: 2.1


Last edited by vjfromgt on Mon Oct 08, 2007 2:15 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject: I got it fixed, problem was ipn_res.php
PostPosted: Wed May 02, 2007 4:48 pm 
Offline

Joined: Mon Apr 09, 2007 7:18 pm
Posts: 43
by default ipn_res.php does not look for duplicate transaction

below would be the modified ipn_res.php that looks for duplicate and ignores

<?php
include ("../lib/defines.php");
include ("../lib/Form/Class.FormHandler.inc.php");
include ("../Public/form_data/FG_var_card.inc");


$DBHandle = DbConnect();

/* FOR TEST
$txn_id = '44444444'.rand(1,999);
$item_number='2222222222';
$quantity = 1; $tax =1.2;
$mc_gross = "50"; $mc_fee = "5"; $mc_currency = 'eur';
*/


// paypal email
$paypal_email = PAYPAL_EMAIL;

// email address where script should send notifications
$error_email = PAYPAL_ERROR_EMAIL;

// email header
$em_headers = "From: ".PAYPAL_FROM_NAME." <".PAYPAL_FROM_EMAIL.">\n";
$em_headers .= "Reply-To: ".PAYPAL_FROM_EMAIL."\n";
$em_headers .= "Return-Path: ".PAYPAL_FROM_EMAIL."\n";
$em_headers .= "Organization: ".PAYPAL_COMPANY_NAME."\n";
$em_headers .= "X-Priority: 3\n";


// -----------------


require("ipn_cls.php");

$paypal_info = $_POST;
$paypal_ipn = new paypal_ipn($paypal_info);

foreach ($paypal_ipn->paypal_post_vars as $key=>$value) {
if (getType($key)=="string") {
eval("\$$key=\$value;");
}
}

$paypal_ipn->send_response();
$paypal_ipn->error_email = $error_email;

if (!$paypal_ipn->is_verified()) {
$paypal_ipn->error_out("Bad order (PayPal says it's invalid)" . $paypal_ipn->paypal_response , $em_headers);
die();
}


switch( $paypal_ipn->get_payment_status() )
{
case 'Pending':

$pending_reason=$paypal_ipn->paypal_post_vars['pending_reason'];

if ($pending_reason!="intl") {
$paypal_ipn->error_out("Pending Payment - $pending_reason", $em_headers);
break;
}


case 'Completed':

$date = date("D M j G:i:s T Y", time());
error_log ("\n\n[$date] Get a request - \n\n"."payer_id , payment_date , txn_id , first_name , last_name , payer_email , payer_status , payment_type , memo , item_name , item_number , quantity , mc_gross , mc_currency , address_name , address_street , address_city , address_state , address_zip , address_country , address_status , payer_business_name , payment_status , pending_reason , reason_code , txn_type", 3, PAYPAL_LOGFILE);

/*$qry= "SELECT i.mc_gross, i.mc_currency FROM item_table as i WHERE i.item_number='$item_number'";
$res=mysql_query ($qry);
$config=mysql_fetch_array($res);*/

$q = mysql_query("SELECT txn_id FROM cc_paypal WHERE txn_id='$txn_id'");

if (mysql_num_rows($q) != "0") {
$paypal_ipn->error_out("[item_number:$item_number] - This was a duplicate transaction or wrong sql (cc_paypal -> $field_insert|$value_insert) error:".$instance_sub_table -> errstr, $em_headers);
die;
}


if ($paypal_ipn->paypal_post_vars['txn_type']=="reversal") {
$reason_code=$paypal_ipn->paypal_post_vars['reason_code'];
$paypal_ipn->error_out("PayPal reversed an earlier transaction.", $em_headers);
// you should mark the payment as disputed now
} else {

/*if (
(strtolower(trim($paypal_ipn->paypal_post_vars['business'])) == $paypal_email) && (trim($mc_currency)==$config['mc_currency']) && (trim($mc_gross)-$tax == $quantity*$config['mc_gross'])
) {*/
if (strtolower(trim($paypal_ipn->paypal_post_vars['business'])) == $paypal_email) {

$field_insert = "payer_id , payment_date , txn_id , first_name , last_name , payer_email , payer_status , payment_type , memo , item_name , item_number , quantity , mc_gross , mc_fee , tax , mc_currency , address_name , address_street , address_city , address_state , address_zip , address_country , address_status , payer_business_name , payment_status , pending_reason , reason_code , txn_type";

$value_insert = "'$payer_id', '$payment_date', '$txn_id', '$first_name', '$last_name', '$payer_email', '$payer_status', '$payment_type', '$memo', '$item_name', '$item_number', $quantity, $mc_gross, $mc_fee, $tax, '$mc_currency', '$address_name', '".nl2br($address_street)."', '$address_city', '$address_state', '$address_zip', '$address_country', '$address_status', '$payer_business_name', '$payment_status', '$pending_reason', '$reason_code', '$txn_type'";

$instance_sub_table = new Table("cc_paypal", $field_insert);

$result_query = $instance_sub_table -> Add_table ($DBHandle, $value_insert, null, null);

if (!$result_query ){
$paypal_ipn->error_out("[item_number:$item_number] - This was a duplicate transaction or wrong sql (cc_paypal -> $field_insert|$value_insert) error:".$instance_sub_table -> errstr, $em_headers);
}else{
$paypal_ipn->error_out("This was a successful transaction", $em_headers);
}

$cardnumber = $item_number;
if ($cardnumber>0){
/* CHECK IF THE CARDNUMBER IS ON THE DATABASE */
$instance_table_card = new Table("cc_card", "username, id");
$FG_TABLE_CLAUSE_card = "username='".$cardnumber."'";
$list_tariff_card = $instance_table_card -> Get_list ($DBHandle, $FG_TABLE_CLAUSE_card, null, null, null, null, null, null);
print_r($list_tariff_card);
if ($cardnumber == $list_tariff_card[0][0]) $id = $list_tariff_card[0][1];
}

if ($id>0){
$mycur = $currencies_list[strtoupper($mc_currency)][2];
$addcredit = $mc_gross / $mycur;


$instance_table = new Table("cc_card", "username, id");
$param_update .= " credit = credit+'".$addcredit."'";
$FG_EDITION_CLAUSE = " id='$id'";
$instance_table -> Update_table ($DBHandle, $param_update, $FG_EDITION_CLAUSE, $func_table = null);

$field_insert = "date, credit, card_id";
$value_insert = "now(), '$addcredit', '$id'";
$instance_sub_table = new Table("cc_logrefill", $field_insert);
$result_query = $instance_sub_table -> Add_table ($DBHandle, $value_insert, null, null);

$field_insert = "date, payment, card_id";
$value_insert = "now(), '$addcredit', '$id'";
$instance_sub_table = new Table("cc_logpayment", $field_insert);
$result_query = $instance_sub_table -> Add_table ($DBHandle, $value_insert, null, null);


}

} else {
$paypal_ipn->error_out("Someone attempted a sale using a manipulated URL ($qry)", $em_headers);
}
}
break;

case 'Failed':
// this will only happen in case of echeck.
$paypal_ipn->error_out("Failed Payment", $em_headers);
break;

case 'Denied':
// denied payment by us
$paypal_ipn->error_out("Denied Payment", $em_headers);
break;

case 'Refunded':
// payment refunded by us
$paypal_ipn->error_out("Refunded Payment", $em_headers);
break;

case 'Canceled':
// reversal cancelled
// mark the payment as dispute cancelled
$paypal_ipn->error_out("Cancelled reversal", $em_headers);
break;

default:
// order is not good
$paypal_ipn->error_out("Unknown Payment Status - " . $paypal_ipn->get_payment_status(), $em_headers);
break;

}

?>


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 11 posts ] 
Hosted Voice Broadcast


All times are UTC


Who is online

Users browsing this forum: No registered users and 15 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group