1. Start Solicitation
To start the credit solicitation and prepare the identification form, the shop must send the shopping cart and data about the shopper to SeQura. The data to be sent is described in detail in Order API Payload and Examples.
The shop makes a POST
request to /orders
and gets back the URL to the order object on SeQura's server, through the Location header's field. Since this URL is needed for the steps that follow, the shop should store it in its database or in the shopper's session.
cURL example
cURL
is a command-line tool for making HTTP(S) requests. We provide acurl
example here not because it is the best way to integrate SeQura's API in a shop, but since it can be run with very little setup and provide a quick start for integrators.curl
is available for Unix, Windows and Mac OS.
To run this example, you need a JSON payload in the file checkout_sample.json
in the local directory. You can use the data in JSON Example as a starting point.
Request Example (cURL)
$ SQPASS='yourAccountKey:yourAccountSecret'
$ curl -i -X POST -u $SQPASS -k \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
-H 'Sequra-Merchant-Id: yourMerchantID' \
--data-binary @checkout_sample.json \
https://sandbox.sequrapi.com/orders
Response Example
HTTP/1.1 100 Continue
HTTP/1.1 204 No Content
Cache-Control: no-cache
Date: Mon, 06 Feb 2017 17:18:51 GMT
Location: https://sandbox.sequrapi.com/orders/1dc26b35-06f6-41d6-b6f5-d0eb6c66aad1
Server: nginx
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-Request-Id: acdaa7e4-61ef-40a6-878d-0c562257a71c
X-Runtime: 0.035769
X-XSS-Protection: 1; mode=block
Connection: keep-alive
PHP example
There is a PHP example of the full checkout in Calling the Order API . This step corresponds to $client->startSolicitation()
.
Errors
The API may refuse to start the solicitation: it returns a 409 error code and an explanation of the conflict.
{
"errors": ["Invalid data: items' total_with_tax add up to 5055 (200+295+-1500+6060) but order_total_with_tax is 5097. The diff is 42."]
}
Notes
- Remember to send prices as integers in cents and not as Euros.
- Make sure that the entire JSON must be in UTF-8. ISO-8859 is not allowed.
- If you set the mandatory
Content-Length
header manually, remember to count the number of bytes, not characters, in the payload.
Updated 5 days ago