Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Easiest way to implement PayPal / any checkout? (PHP)
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

Easiest way to implement PayPal / any checkout? (PHP)

gol3mgol3m Member

I need a simple page where I can output a button via PHP that says "pay xxx€ via PayPal now". Then the customer pays and the invoice gets marked as paid.

What is the easiest way to do this? I have been looking at the PayPal docs, but it's stupidly complicated. I don't need/want an SDK, I don't need/want JavaScript, I only need to POST the amount, perhaps some kind of API key, and a reference, and get notified whether it was paid.

If/since PayPal doesn't offer this, is there maybe a payment provider that has extremely simple checkout?

Thanks

Comments

  • Don't bother if you don't know 😁

  • AmitzAmitz Member
    edited March 2019

    His problem does not seem to be the embedment, but rather receiving the feedback from Paypal's API that an invoice with a certain reference has been paid to automatically mark it as such. Or am I wrong here?

  • You can hire me =)

  • gol3mgol3m Member

    @Amitz said:
    His problem does not seem to be the embedment, but rather receiving the feedback from Paypal's API that an invoice with a certain reference has been paid to automatically mark it as such. Or am I wrong here?

    Everything is the problem. I'd like a simple no-javascript, no-SDK form that redirects you to PayPal, then PayPal redirects you back and tells me user Amitz paid for 1 roll of toilet paper.

  • @gol3m said:

    @Amitz said:
    His problem does not seem to be the embedment, but rather receiving the feedback from Paypal's API that an invoice with a certain reference has been paid to automatically mark it as such. Or am I wrong here?

    Everything is the problem. I'd like a simple no-javascript, no-SDK form that redirects you to PayPal, then PayPal redirects you back and tells me user Amitz paid for 1 roll of toilet paper.

    This part where "tells me user Amitz paid for 1 roll of toilet paper." is the one which is most difficult to acheive when implementing payment gateways

    These are bascially pre defined webhooks which paypal will trigger only to the assigned url in the settings

    This basically stops hackers

    If you implement it the way you have written any one with decent amount of knowledge can decieve your system and cant act like a paid user

  • gol3mgol3m Member

    @noaman said:
    This part where "tells me user Amitz paid for 1 roll of toilet paper." is the one which is most difficult to acheive when implementing payment gateways

    These are bascially pre defined webhooks which paypal will trigger only to the assigned url in the settings

    I understand that, I just need to know how I can implement this. I literally just need to know how to make a form and how to make PayPal tell me who paid for what.

    User goes to pay.php, clicks to pay with PayPal, is redirected to paypal.com, pays, is redirected to paid.php, PayPal calls back to confirmation.php with the details.

    However, all I can find is shitty JavaScript, or "install this SDK", or "buy now buttons".

  • Adam1Adam1 Member
    edited March 2019

    surprised you didnt look at paypals quite decent documentation before posting:

    https://developer.paypal.com/docs/notifications/

    essentially you specify an IPN url in your paypal dev account, then on your server you just need an http accessible URL which will process the initial post request, then call a paypal URL to validate the post (in case of fake IPNs).

  • If don't have enough knowledge then it will be better to hire a programmer or developer.

  • @gol3m said:

    @noaman said:
    This part where "tells me user Amitz paid for 1 roll of toilet paper." is the one which is most difficult to acheive when implementing payment gateways

    These are bascially pre defined webhooks which paypal will trigger only to the assigned url in the settings

    I understand that, I just need to know how I can implement this. I literally just need to know how to make a form and how to make PayPal tell me who paid for what.

    User goes to pay.php, clicks to pay with PayPal, is redirected to paypal.com, pays, is redirected to paid.php, PayPal calls back to confirmation.php with the details.

    However, all I can find is shitty JavaScript, or "install this SDK", or "buy now buttons".

    What you need is WordPress

    Most of the things are straight forward and are easy to setup and plenty of support

  • gol3mgol3m Member

    @noaman said:
    What you need is WordPress

    Well, I asked for the easiest way to integrate a payment gateway via PHP, so if anyone could help me with that, it would be great.

  • @gol3m said:

    @noaman said:
    What you need is WordPress

    Well, I asked for the easiest way to integrate a payment gateway via PHP, so if anyone could help me with that, it would be great.

    There are (literally) hundreds of IPN examples on the Internet.

    Use this: https://github.com/paypal/ipn-code-samples/blob/master/php/PaypalIPN.php

    All you need to do use their (pre-written) PHP library and this: https://github.com/paypal/ipn-code-samples/blob/master/php/example_usage.php

    The example file already provides the logic for contacting PayPal and verifying the transaction. You need to implement what happens after the TX is verified but that shouldn’t be too hard...

    Side note: we’re not a charity here — don’t expect us to spew out code for you. If you don’t understand how to use the libraries (which you need to use to prevent people from modifying your checkout total), you’re better off hiring someone to do it for you.

    Thanked by 1angstrom
  • gol3mgol3m Member

    @doghouch said:

    Side note: we’re not a charity here — don’t expect us to spew out code for you. If you don’t understand how to use the libraries (which you need to use to prevent people from modifying your checkout total), you’re better off hiring someone to do it for you.

    I mean I didn't ask how to use the library, I just asked for the easiest way to implement a payment gateway, and specifically stated that I don't want any kind of SDK.

    I looked at stripe, but their client-only checkout does not work. It's extremely simple, but nothing happens when I click the embedded button (it's copying and pasting code, not magic). Support acknowledged there must be something wrong, but was unable to figure it out (including their supervisor).

    Is there no payment gateway that only requires a POST/GET request, nothing else?

  • @gol3m said:

    @doghouch said:

    Side note: we’re not a charity here — don’t expect us to spew out code for you. If you don’t understand how to use the libraries (which you need to use to prevent people from modifying your checkout total), you’re better off hiring someone to do it for you.

    I mean I didn't ask how to use the library, I just asked for the easiest way to implement a payment gateway, and specifically stated that I don't want any kind of SDK.

    I looked at stripe, but their client-only checkout does not work. It's extremely simple, but nothing happens when I click the embedded button (it's copying and pasting code, not magic). Support acknowledged there must be something wrong, but was unable to figure it out (including their supervisor).

    Is there no payment gateway that only requires a POST/GET request, nothing else?

    You’re out of luck then...

  • @gol3m said:
    Is there no payment gateway that only requires a POST/GET request, nothing else?

    Travel back to 1996, and sure.

  • Look on codecanyon something might fit what you want.

  • @gol3m Here is your easy answer. Because I personally had to do something similar in the past.

    Steps
    1) Login to Paypal
    2) [Tools] >> [Paypal Buttons] >> Choose the (Buy Now) button
    3) Add all your product information into the page Paypal brought you to
    4) Edit the above's [Step: 3 Customize advanced features] >> "Add advanced variables" >> notify_url=https://example.com/gol3m_paypal_ipn.php
    5) Use a PHP script like so: https://pastebin.com/RrhSdsf1
    6) Alter above PHP script to use mysqli and to have the php code activate whatever product or purchase the customer purchased. Also change from sandbox to regular paypal once done testing.

Sign In or Register to comment.