Use PayPal Payment in an ASP.NET Web Application 3/3

Running Sample

The payment process is started with the PaymentStart.aspx site. After clicking button „Payment Start“ a connection to PayPal is etablished for authorization of buyer.

Please note the forwarding to https://sandbox.paypal.com URL in sandbox mode.

Now the well-known PayPal login mask can be seen.

Login with your test buyer account and you are forwarded to your test store.

You can select Continue (Weiter) or cancel and back to store. Please try both in your shop system! After clicking forward the authorized buyer is used for payment process and PayPal forward to PaymentComplete.aspx page.

With the PaymentComplete.aspx page you can implement the steps which are neccessary to complete the payment and the purchase in your shop system.

Make The App Able to Run

There are two modes available, the sandbox mode for testing and the live mode for productive systems. The switch between both is the IsTest boolean variable. If IsTest set to true, the sandbox mode is active. In the first lines of class PaymentConfiguration you can find the variable.

With the variable a switch between sandbox client ID / client secret and live sandbox client ID / client secret is implemented.

Insert your client id and client secret to sandbox configuration.

Start the web application project in debug mode now and test the payment process in the sandbox.

Go To Live

You need the client ID and client secret for PayPal Live mode. This keys can be created at https://developer.paypal.com webpage.

  • Go to Rest API apps and click to your app.
  • Switch between Sandbox and Live mode on the top right corner.
  • Get your client ID and client secret keys to implement in the web application.

Sample Code

PayPal Demo Sources for ASP.NET

Dieser Beitrag wurde unter DevCorner abgelegt und mit , verschlagwortet. Setzen Sie ein Lesezeichen auf den Permalink.

4 Antworten zu Use PayPal Payment in an ASP.NET Web Application 3/3

  1. Ahmad fahel sagt:

    many thanks for your sample. it save my time

  2. Chris sagt:

    Very helpful! I couldn’t find a better sample anywhere else! This works perfectly, however I was wondering how to send/get multiple items at once? PayPal says that you can send multiple items as a group but I can not figure it out!

    • Andreas Ulbricht sagt:

      Please have a look to class PaymentPrepare and the GetTransactionsList() methode.In the ItemList() you can define multiple items at once.

  3. Mohamad Salloum sagt:

    Gorgeous! thank you very much!

Schreiben Sie einen Kommentar

Ihre E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert