Receiving payments via online payment systems
Using Demo PSP API allows you to organize all supported payment systems (that are continuously increasing) after a one-time configuration.
API working algorithm
To work with online payment systems you need to send a request to Demo PSP API. Regardless of request type (request to receive payment or request for payment status or something else) each request to API must meet the following requirements:
- to use HTTP Basic authentication with Shop ID and Secret Key;
- to contain headers
Content-Type: application/json
andAccept: application/json
; - to have a JSON body.
Regardless of the payment method, the basic algorithms for making the payment are standard. They require sending specific requests in specific formats, processing received responses and processing of callbacks. In the standard case, regardless of the used payment method and payment details, to make a request you need:
-
To send the appropriate request to Demo PSP API and receive a response.
-
If request data are correct and payment can be directly executed Demo PSP API returns successful or failed and creates webhook (callback) to URL from
notification_url
parameter and shows the payment result of payment in merchant's backoffice; -
If request data are correct, but the payment cannot be executed directly Demo PSP API returns a response with a pending status and a form with fields for redirecting the user to the online payment method site. By using the received fields you must create a web form for the user and after submitting this form the user will be redirected to the payment method site where he(she) can make the payment. When the user is on the payment method site, Demo PSP waits for system notification about changing payment status.
-
When the status is finally changed, callback to URL from
notification_url
parameter (if presented) sends with all the information about the made payment (you can find more information about webhooks (callbacks) at payment notification document). If there was nonotification_url
parameter in the request, callback is not sent and payment result can be requested by uid . -
After finishing the payment on the site of the payment method, the user returns to Demo PSP and is then redirected to your site or mobile application to the URL sent in
return_url
. -
When your shop handles appropriate callbacks, we recommend you to request a payment status by uid and depending on the received status, you can show to the user what is going on with the payment. If Demo PSP API returns a pending status this means that the user is still on the online payment method site, the payment has not made and you need to repeat your request after some time.
See the description of each transaction type for detailed information about the request and response methods and schemes.