Responsive web payment: Difference between revisions
Jump to navigation
Jump to search
Line 2: | Line 2: | ||
= The payment process = | = The payment process = | ||
In this scenario the payment starts with the preparation of the payment. This means that the webshop creates a JSON representation of the payment data. This data contains all the necessary information about the items to be purchased, the customer and the desired payment scenario. This JSON should be sent as a POST request to the /v2/Payment/Start API endpoint. After the system recives the data and | # In this scenario the payment starts with the preparation of the payment. This means that the webshop creates a JSON representation of the payment data. This data contains all the necessary information about the items to be purchased, the customer and the desired payment scenario. This JSON should be sent as the body of a POST request to the <code>/v2/Payment/Start</code> API endpoint. After the system recives the data it will be validated. If all the properties are correct a payment will be prepared in the database and a HTTP response is returned to the webshop. | ||
# The response should be processed by the webshop system and the Id of the payment (<tt>PaymentId</tt>) should be extracted from the response. This Id should be stored in the webshop database with the initial information about the payment. This is necessary because every following request is based on this Id. | |||
# The next step is to redirect the customer to the Barion website to a specific URL with the <tt>PaymentId</tt> as a query parameter. | |||
# After the customer paid the requested amount and the payment is completed a server to server request is initiated by Barion towards the webshop. This is called the ''callback mechanism''. | |||
# At this point the customer is advised on the screen to return to the webshop to complete the process. If the customer clicks through the customer is redirected back to the webshop. | |||
# At any point of the process the webshop can request information about the payment through the <code>v2/Payment/GetPaymentState</code> API endpoint. | |||
= Preparing the payment = | = Preparing the payment = |
Revision as of 18:03, 2 February 2017
This scenario is the most common integration for webshops that don't need any extra steps in the payment process.
The payment process
- In this scenario the payment starts with the preparation of the payment. This means that the webshop creates a JSON representation of the payment data. This data contains all the necessary information about the items to be purchased, the customer and the desired payment scenario. This JSON should be sent as the body of a POST request to the
/v2/Payment/Start
API endpoint. After the system recives the data it will be validated. If all the properties are correct a payment will be prepared in the database and a HTTP response is returned to the webshop. - The response should be processed by the webshop system and the Id of the payment (PaymentId) should be extracted from the response. This Id should be stored in the webshop database with the initial information about the payment. This is necessary because every following request is based on this Id.
- The next step is to redirect the customer to the Barion website to a specific URL with the PaymentId as a query parameter.
- After the customer paid the requested amount and the payment is completed a server to server request is initiated by Barion towards the webshop. This is called the callback mechanism.
- At this point the customer is advised on the screen to return to the webshop to complete the process. If the customer clicks through the customer is redirected back to the webshop.
- At any point of the process the webshop can request information about the payment through the
v2/Payment/GetPaymentState
API endpoint.
Preparing the payment
Assembling the POST request
TODO
Processing the response
TODO
Redirecting the customer
TODO
Processing the callback
TODO
Requesting information about the payment
TODO
Asssembling the GET request
Processing the response
Processing the returning customer
TODO