Status API

The Snap Status API has been created to allow retailers to directly get the status of an application. We recommend to call this on the server side to get the application status. Retailers can then update their orders based on the code response.

If you aren't familiar with the SDK, please read the Javascript SDK documentation first.

API Details

🧪 Sandbox Environment: This environment should be used during the integration phase. This environment is a safe space to test your integration without affecting real production data. The base URL for the sandbox environment is:

⚠️ Production Environment: Once your integration has been tested and is ready for production, you should update your API requests to point to the production environment. All API requests will interact with live data. The base URL for the production environment is:

Headers: Ensure that this header is included in every API request. Failure to include a valid authorization token will result in unauthorized access and the request being denied by the server.

Response: You will receive a "progressStatus" field. This field indicates the current state or stage of the operation being performed. An example response might look like this:

Further Explanation

Once the Checkout has loaded, the user will start to make their way through the journey. At certain points in this journey, the SDK will call the retailer methods which the retailer defines when invoking the snapuk.checkout.button method. When these methods are triggered, we pass you the applicationId and a bearer token. Using these values the retailer can call our Status API to get a status code and based on that status code they can update the order on their side, using the applicationId as reference. We recommend Retailers make the Status API call and update the order on the server side.

How to Implement?

This depends on the how the Retailer application has been created. If you have access and the ability to create a server side service then this can be done in your existing application. If not, then you may be required to create another small server side service.

This service must call the Status API, which will return a status code. Based on the response code, you can update your order accordingly. Please see the diagram and status codes below.

Status API flow

Codes and states

The status code returned for each application will be one of the following. You can see what each code means below:

  • progressStatus:  2 = PENDING
  • progressStatus:  6 = APPROVED
  • progressStatus: 10 = APPROVED_WITH_CONDITIONS
  • progressStatus: 14 = DENIED
  • progressStatus: 18 = WITHDRAWN
  • progressStatus: 22 = PENDING_DOCS
  • progressStatus: 26 = PENDING_DEL (This is the expected status for the 'onSuccess' method)
  • progressStatus: 30 = COMPLETE
  • progressStatus: -1 = ERROR
  • progressStatus:  0 = FUNDED

Implementation

Step 1: Create a new service

This is a high level example of how to create a new service. You may be able to do this in your existing application and not require a new service.
This is a simple API example which we pass the applicationId and token to in Node.js.
This API would be called from any of the retailer methods such as onSuccess or onWithdrawn etc from the client side.
The token and the applicationId must be received in the request. These are the only 2 parameters to be used.
The service will call the Status API to check the status of the application.
Based on the status code returned, the retailer can update their orders database accordingly. In this case, the status code for an approved application is 6 (see codes and states above).
For production integration, replace base url with: https://app.snapfinance.co.uk

Step 2: Integrate the service with the checkout button

Once our Retailer methods get triggered, we need to pass the token and the applicationId that are provided into the API request.
You can pass these however you like. We just need them inside the service to call the Status API.
Lets assume that the new service is running in https://example.co.uk.