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.
- Open https://developer.paypal.com and login with your business account.
- Go to Dashboard an My Apps & Credentials
- 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.
many thanks for your sample. it save my time
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!
Please have a look to class PaymentPrepare and the GetTransactionsList() methode.In the ItemList() you can define multiple items at once.
Gorgeous! thank you very much!