user136252
user136252

Reputation: 41

Paypal person to person Payment Integration with PHP

I have been searching for Paypal person to person Payment integration code with PHP

I hope you can help me what PayPal Code that I can use.I already tried with normal paypal integration(transfer from personal to business) by assigning receiver paypal personal account email id as the business id.

<input type="hidden" id="amount" name="amount" value="<?= $_REQUEST['amount'] ?>" />
<input type="hidden" name="cmd" value="_xclick">
**<input type="hidden" name="business" value="<?= $event['donation_email'] ?>">**
<input type="hidden" id="item_name" name="item_name" value="Contribution for <?= $event['events_name'] ?>">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="no_shipping" value="1" />
<input type="hidden" name="return" value="<?= notices::generate_events_link($event['events_id']) ?>?notice=<?= urlencode('Thank you for your gift!') . '&from_paypal=1' ?>" />
<input type="hidden" name="cbt" value="<?= SITE_NAME ?>" />
<input type="hidden" name="rm" value="2">
<input type="hidden" name="notify_url" value="<?= FULLURL . 'events/successful-payment' ?>" />

But it was not giving expected result.

Here is the point for my website payment.

  1. A user will type amount of fund that he want to transfer to a paypal account with email id passing with one of the hidden fields

  2. when user clicks pay now button and it will redirect to Paypal Page and transfer money to paypal account with email id passed with the request

Thank you!

Upvotes: 2

Views: 1596

Answers (2)

pp_pduan
pp_pduan

Reputation: 3402

Your code snippet will work for the payment part, but these tags won't always take effect

<input type="hidden" name="return" value="<?= notices::generate_events_link($event['events_id']) ?>?notice=<?= urlencode('Thank you for your gift!') . '&from_paypal=1' ?>" />
<input type="hidden" name="rm" value="2">
<input type="hidden" name="notify_url" value="<?= FULLURL . 'events/successful-payment' ?>" />
return 
notify_url

are dependent to the payee's account (the value in the "business" tag) feature setup , that means the precondition of this P2P function is that auto-return/PDT and IPN are enabled in each recipient's PayPal account, otherwise you would end up losing contorl of the transaction status from the call-backs

You may consider the more sophisticated way of an API integration of Adaptive Payments to achieve this. Payer sends the payment to the payee, while you as the platform API caller controls the transaction flow.

The developer site has all the specs and tech resources (SDK) for your reference: https://developer.paypal.com/webapps/developer/docs/classic/adaptive-payments/integration-guide/APIntro/

Upvotes: 1

Paresh Gami
Paresh Gami

Reputation: 4782

New account of paypal need to use paypal sdk.

Please use this one

https://github.com/paypal/PayPal-PHP-SDK

Upvotes: 1

Related Questions