Search code examples
c#asp.net-mvcpaypalpayment-processingpaypal-rest-sdk

Sending customers to a PayPal payment page with a webhook? C#


I'm a bit confused with the PayPal (REST) integration. What I want is the following:

  • My customers on my website see a order-summary, they then click on
    'go to payment page'. I only need to set the Currency, Amount and Description.
  • They arrive on a PayPal page where they choose to signin/as guest, and choose creditcard/paypal account to pay, fill in all the data etc.

  • I get notified by using a webhook that they actually paid, and process the payment internally.(Receiving an email about the status won't let me automate.)

Somehow all the examples I see are about sending complete payments through paypal, and not just 'setting up a payment page'. Is this even possible?

Thanks!


Solution

  • I hope this helps clarify:

    There are 2 types of payments/funding :

    If by "payment page" you mean collecting payment info (credit card) on your website and sending it to a "gateway" for processing, then that's the credit_card flow option. There are account requirements for that (and PCI compliance).

    The flow you describe above is the paypal flow. Your customers go to Paypal, select whatever payment instrument they have/choose (credit card, bank account, etc.) and then "approve" your request for a transaction.

    When they "approve" - don't confuse this with payment, they are merely saying "yes, I want to pay this merchant using my Paypal account/funds", they are redirected back to your web site/application (to complete/finish things). At which point you will perform the necessary steps to "complete" the transaction request (e.g. send an execute, authorizeand capture request - depending on what you want).

    So excute and capture (of an authorization) are the actual acts of "obtaining the actual payment so you get paid". You will get some result in the response to these requests at this stage for you to determine things.

    If you've used the Classic API, this maps to Express Checkout. I'd map webhook to IPN (optional messaging/event tracking, and really isn't part of your payment/checkout flow).

    Hth...


    Update:

    I'd really suggest that you take a look at the SDK (.Net). It's very well maintained and Paypal dev support is awesome. The samples will really get you going quickly.