What is Nova MVC
How to integrate PayPal payments into an MVC application
The payment process
The config manager from the PayPal namespace. API reads the setting from the web.config so that the app receives an OAuth token with which it can identify itself to the PayPal services.
Now the PayPal payment must be created and sent to PayPal so that the customer authenticates himself and confirms the payment. The PayPal API has provided several classes for this:
- Payment: Creates the payment and executes the payment.
- Payer: Information about the customer.
- RedirectUrl: Defines to which URLs PayPal should forward after a payment or after the cancellation of a payment.
- Transaction: Contains the most important information about a payment
Amount: Contains information about the amount such as monetary currency, tax information and total amount.
ItemList: Is a collection of items (item with all related information such as price, number, description, etc.)
The classPayment offers the methodCreate to make the payment:
A request is sent to PayPal with all payment information. In response to this, the app receives a URL to which the user is redirected. In order to recognize the user, the payment ID is saved in the session.
The user has to log in to PayPal and make the payment. Which payment method he uses to pay at PayPal is not important to us. PayPal accepts the payment and directs the user to the redirect URL that we received or to the cancel URL if the user cancels the payment.
PayPal adds parameters to the URL it has received from us and forwards the user to them. Based on the parameters and the information stored in the session, the process is recognized and the payment is continued.
After the user has confirmed the payment, the classPayment executed. For this the methodExecute called.
The method queries the status of the transaction from PayPal and receives the status of the payment in response. If the status is "approved", the payment was successful, otherwise it was not. A payment can have 3 different statuses:
- Created: The transaction has been created but has not yet been confirmed by the payer.
- Approved: The payer has confirmed the payment with PayPal.
- Failed: The transaction was unsuccessful.
The application should then - depending on the status - forward the user to another page or display a corresponding message.
- The engineering degree in India is dead
- Do you love biology or math
- Why did Colorado Avalanche trade with Matt Duchene
- Is Apple's random number algorithm bad
- Why Depression Can Kill People
- How reliable is ContentMart for content writers
- Why do engineering students drink
- What's your rating of Thumbtack
- How is syphilis treated
- Do you even play league
- Why don't you try Hindi Quora
- What are your best paragliding pictures
- Why do space missiles explode
- Are there other time measurements
- What tools are needed for cybersecurity analysis
- Which coding language should quality assurance know?
- Vegetable meat is a good investment
- Where does screen printing come from?
- What are some examples of personal identity
- Is wood a hardwood
- Did you write poems about your husband?
- I love to learn
- How can we get close to God
- What is a blue building