Is it possible to achieve this with Paypal?

Hello everyone.

I am trying to add a feature in my website where users can make a payment. The amount to be payed is calculated via PHP on my site, and I need to pass this value along some other variables located in my PHP, to the Paypal payment page. However, I have not been able to achieve this and it makes me wonder if Paypal even offers this possibility in the first place.

I made a diagram that shows more or less what I am trying to achieve:

[CENTER][/CENTER]

Basically, I tried to insert a Paypal ‘Pay Now’ button on my site, but when the user clicks it, it prompts for payment amount input, which makes it useless for me. I need that Paypal checkout page to display the amount to charge with the variable I’m passing to it. I know that I can add variables to the button on creating via the Paypal website, but it only allows me to set static prices.

Apart from this, I also would like to know if when the transaction finishes succesfully on the Paypal payment page, do I get some sort of return value/signal that lets me know if there was a success/error ? I need this signal in order to do some other processes on my website with PHP.

I would greatly appreciate help, I’m at a total loss and I need to implement this badly for a serious project I’m working on.

See https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_html_Appx_websitestandard_htmlvariables for the list of all the parameters that you can pass to Paypal.

The amount is one of the values that you are allowed to pass.

There are a couple of custom fields that you can use to pass values that Paypal doesn’t have listed - if you have lots of data that you need to assocate with a payment then store all the info in a database and pass the key of that record in a custom field so you can use it to retrieve the rest of the data.

https://www.paypal.com/ipn

I checked that site before, I tried sending my price value within HTML with the code given to me when I create a Pay Now button, I tried sending it as a hidden input but it won’t work. In paypal it says “Use a line break between each variable. The variables will appear in your button’s HTML code. Learn more” however the code given to me is always the same, I don’t see any change.

So if my variables are not supposed to be passed as hidden inputs within the button’s form, then how? What am I doing wrong…

<input type='hidden' name='amount' value='$price'>

The above code is inside the form code generated by PayPal. All of this code is echoed.

Thanks for this link, I will look into it.

Ok. I finally managed to solve all the above and just need to add one final thing.

After this payment I recieve from a user, I need to make another Paypal transaction to another Paypal account, automatically. Is this even possible? The only thing I can think of right now would be to call some sort of procedure in my IPN after its been successfully recieved. But do I write the procedure?

This is the final step for this Paypal implementation, help would greatly be appreciated.

You can use either adaptive payments api
https://www.x.com/content/introducing-adaptive-payments

or mass payment api
https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/howto_api_masspay

bear in mind a transaction fee will be incurred by either the sender or recipient depending on how you set this up

Might be a bit off topic, but if you want seamless credit card site integration (and, thus, being able to do whatever you want with your orders/data), I would suggest looking into stripe.com