I've been trying to figure this out alone. However, there is something odd going on here. I've got a hidden custom field with the e-mail of a user (just in case they use another email at paypal), but - when the IPN request is done, the custom field is strong my IP address? is there any reason for this?
Form,
<input name="description" id="description" type="hidden" value="<?php echo $paypal_product ?>" />
<input name="amount" id="amount" type="hidden" value="<?php echo $paypal_price ?>" />
<input name="product_id" id="product_id" type="hidden" value="<?php echo $paypal_product_id ?>" />
<input name="currency" id="currency" type="hidden" value="NOK" />
<input name="custom" id="custom" type="hidden" value="<?php echo $this->session->userdata('mail') ?>, <?php echo $paypal_product_id ?>" />
From a PayPal point of view there's no reason for this. It simply means $this->session->userdata('mail') doesn't contain what you expect it to. Debug, echo, debug.
Related
I have integrated Paypal standard payment in my php website now i required to send tax in Paypal payment so i have pass tax_rate variable in paypal form, all are working nice but tax is not send in paypal.
My Paypal form code is below.
<form action="<?php echo PAYPAL_URL;?>" name="paypalForm" method="post">
<input type="hidden" name="business" value="<?php echo PAYPAL_EMAIL;?>">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="item_name" id="item_name" value="<?php echo $mainObj->listing_title;?>">
<input type="hidden" name="item_number" id="item_number" value="<?php echo $booking_id;?>">
<input type="hidden" name="custom" value="<?php echo $mainObj->user_id.'__'.$objExtraPostData->message_to_host.'__'.$objExtraPostData->host_call.'__'.$vat.'__'.$mainObj->pay_price.'__'.$guest_invite_id.'__'.$host_invite_id.'__'.$review_guest_invite_id.'__'.$review_host_invite_id; ?>"/>
<input type="hidden" name="amount" id="amount" value="<?php echo $mainObj->pay_price;?>">
<input type="hidden" name="discount_amount" id="discount_amount" value="<?php echo $discount_price;?>">
<input type="hidden" name="tax_rate" value="<?php echo $vat;?>">
<input type="hidden" name="currency_code" value="<?php echo DEFAULT_PAYMENT_CURRENCY_CODE;?>">
<input type="hidden" name="return" value="<?php echo SITE_MOD."nct-paypal/thankyou.php";?>">
<input type="hidden" name="cancel_return" value="<?php echo SITE_MOD."nct-paypal/failed.php";?>">
<input type="hidden" name="notify_url" value="<?php echo SITE_MOD."nct-paypal/notify.php";?>">
</form>
Check if the tax_rate can be used with your payment type. In addition, it might be better when you set your tax rate in your account profile as described beneath.
Transaction-based tax override variable. Set this variable to a percentage that applies to the amount multiplied by the quantity selected during checkout. This value overrides any tax settings set in your account profile. Allowable values are numbers 0.001 through 100. Valid only for Buy Now and Add to Cart buttons. Default – Profile tax settings, if any, apply.
I have no any idea about it. I serched my sites but i can't find solutions.
My requirement is that, my query fetches bank account number from database,
For example, there r one record given by my query then i want to send money to this bank account.
what should i do??? Which api use for me??
My code is given below:
$queryOperator = "SELECT * FROM operatortransaction AS ot LEFT JOIN paymenttransaction AS pt ON
ot.OperatorID != pt.OperatorID WHERE ot.IsPaymentRequest = 1 AND ot.Amount != pt.Amount ";
$arrOperator = $obj->select($queryOperator);
$count = 0;
if(!empty($dataOperator))
{
foreach($arrOperator as $operator)
{
if($arrOperator[$count]['Amount'] >= $arrOperator[$count]['RequestAmount'])
{
$queryDetail = "SELECT * FROM operatorprofile WHERE UserID = '$arrOperator[$count]['OperatorID']' ";
$Data = $obj->select($queryDetail);
// i want to put api code here......//
}
}
}
Thanks.
Hi you can try to use PayPal Xclick
<form action="https://secure.paypal.com/uk/cgi-bin/webscr" method="post" name="paypal" id="paypal">
<!-- Pre Populate the Paypal Checkout Page With Customer Details, -->
<input type="hidden" name="first_name" value="<?php echo Firstname?>">
<input type="hidden" name="last_name" value="<?php echo Lastname?>">
<input type="hidden" name="email" value="<?php echo Email?>">
<input type="hidden" name="address1" value="<?php echo Address?>">
<input type="hidden" name="address2" value="<?php echo Address2?>">
<input type="hidden" name="city" value="<?php echo City?>">
<input type="hidden" name="zip" value="<?php echo Postcode?>">
<input type="hidden" name="day_phone_a" value="">
<input type="hidden" name="day_phone_b" value="<?php echo Mobile?>">
<!-- We dont need to use _ext-enter anymore to prepopulate pages -->
<!-- cmd = _xclick will automatically pre populate pages -->
<!-- More Info: https://www.x.com/docs/DOC-1332 -->
<input type="hidden" name="cmd" value="_xclick" />
<input type="hidden" name="business" value="paypal#email.com" />
<input type="hidden" name="cbt" value="Return to Your Business Name" />
<input type="hidden" name="currency_code" value="GBP" />
<!-- Allow customer to enter desired quantity -->
<input type="hidden" name="quantity" value="1" />
<input type="hidden" name="item_name" value="Name of Item" />
<!-- Custom Value You want to send and process back in the IPN -->
<input type="hidden" name="custom" value="<?php echo session_id().?>" />
<input type="hidden" name="shipping" value="<?php echo $shipping_price; ?>" />
<input type="hidden" name="invoice" value="<?php echo $invoice_id ?>" />
<input type="hidden" name="amount" value="<?php echo $total_order_price; ?>" />
<input type="hidden" name="return" value="http://<?php echo $_SERVER['SERVER_NAME']?>/shop/paypal/thankyou"/>
<input type="hidden" name="cancel_return" value="http://<?php echo $_SERVER['SERVER_NAME']?>/shop/paypal/cancelled" />
<!-- Where to send the paypal IPN to. -->
<input type="hidden" name="notify_url" value="http://<?php echo $_SERVER['SERVER_NAME']?>/shop/paypal/process" />
NOTICE
Do remember to make a very strong VALIDATION!!!
I am using paypal REST API for making direct payments.
I want to create internal transaction id before initiating the transaction and use that for identifying the transactions from my end.
I am trying to set id using
$payment = new Payment();
$payment->setId($tId);
Paypal is approving the request and payment is getting done but I am not getting this id in response.
Is there any way by which I can send custom parameters to paypal and get them back in response?
You can use custom variable to pass your custom data, and paypal will return it backto you in post in response.
<input type="hidden" name="amount" value="<?php echo $totalAmount; ?>"/>
<input type="hidden" name="business" value="your_paypal_biz_id"/>
<input type="hidden" name="notify_url" value="<?php echo site_url(); ?>/zad_notify.php"/>
<input type="hidden" name="item_name" value="Image editing"/>
<input type="hidden" name="currency_code" value="USD"/>
<input type="hidden" name="return" value="<?php echo $paypalReturnUrl; ?>"/>
<input type="hidden" name="cancel_return" value="<?php echo site_url(); ?>/payment_error.php?id=<?php echo $sr_no; ?>"/>
<input type="hidden" name="custom" value="<?php echo $sr_no; ?>" />
alternatively you can also pass your id in notify url as query string parameter and you will get it back in return url file.
<input type="hidden" name="amount" value="<?php echo $totalAmount; ?>"/>
<input type="hidden" name="business" value="your_paypal_biz_id"/>
<input type="hidden" name="notify_url" value="<?php echo site_url(); ?>/zad_notify.php?id=5"/>
<input type="hidden" name="item_name" value="Image editing"/>
<input type="hidden" name="currency_code" value="USD"/>
<input type="hidden" name="return" value="<?php echo $paypalReturnUrl; ?>"/>
<input type="hidden" name="cancel_return" value="<?php echo site_url(); ?>/payment_error.php?id=<?php echo $sr_no; ?>"/>
Hope this help to you, :)
I have tried this code but I didn't get response
<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post" name="fm">
<input type="hidden" name="cmd" value="_cart" />
<input name="currency_code" type="hidden" value="GBP" />
<input type="hidden" name="business" value="test_biz#email.com" />
<?php
for($m=0;$m<4;$m++){
?>
<input type="hidden" name="quantity_<?php echo $m+1; ?>" value="1" />
<input type="hidden" name="item_name_<?php echo $m+1; ?>" value="<?php echo "fhghg"; ?>" />
<input type="hidden" name="amount_<?php echo $m+1; ?>" value="<?php echo 10; ?>" />
<?php
}
?>
<input name="no_shipping" type="hidden" value="2" />
<input type="hidden" name="upload" value="1" />
<input type="hidden" name="return" value="http://localhost/test/test1.php" />
<input type="hidden" name="cancel_return" value="http://localhost/test/test.php" />
<input type="hidden" name="notify_url" value="http://localhost/test/test.php">
<input type='submit' name='submit' value='submit' />
</form>
I have echo the array as print_r($_POST) to print the response. It displayed as Array()
How to solve this?how to pass the variable to paypal for multiple items ?
The superglobal $_POST is always an array. If you only get Array() in the output for print_r($_POST), this means nothing was posted, and the array is empty (just be sure you're using print_r() and not print() here.
If you don't want to print the whole array, but instead print individual fields' values from this array, use keys such as $_POST['item_id'], which prints the value of the item_id key in $_POST.
Is test1.php a Paypal IPN script? Paypal can't access localhost to post order notices to it (the 'notify' field). This has to be an actual URL. If your testing at home try a dynamic ip service like no-ip.com.
Basically I just want to turn off the button after people purchase the art and send them a receipt. I would also like to have a copy of their information. This is what I am passing through my array:
<form method="post" action="https://www.paypal.com/cgi-bin/webscr">
<input type="hidden" name="cmd" value="_xclick" />
<input type="hidden" name="business" value="email#mydomain.com" />
<input type="hidden" name="item_name" value="<?php echo $title; ?> (ID:#<?php echo " {$p['id']}" ?>)" />
<input type="hidden" name="item_number" value="<?php echo "{$p['id']}" ?>" />
<input type="hidden" name="amount" value="<?php echo "{$p['price']}" ?>" />
<input type="hidden" name="shipping" value="39.99" />
<input type="hidden" name="return" value="http://mydomain.com/thankyou.php" />
<input type="submit" value=" " class="button" />
</form>
How do I setup a sold field in my database and show/hide my button in php?
IPN, API which do I need to use to make it happen?
Cheers!
I would setup the IPN listener to mark the item's status as sold in it's database table (you are generating that form based on a database?) when the IPN comes back "VERFIFIED" and payment_status = 'Complete'. Then, only generate that form when the item is not sold.
If you don't know how to implement an IPN listener, here is a tutorial: PayPal IPN with PHP