Skip to content
This repository has been archived by the owner on Feb 5, 2024. It is now read-only.

Latest commit

 

History

History
60 lines (43 loc) · 2.92 KB

README.md

File metadata and controls

60 lines (43 loc) · 2.92 KB

SendCloud API Integration Example

There are various ways to integrate the SendCloud shipping solution with your own platform.
The API documentation gives a complete overview of the possibilities.
This repository should provide you clear and understandable examples on how you can integrate SendCloud.

Setting up the API credentials

Before you can interact with the API it is essential that you setup API credentials.
Make sure that you are signed up by creating an account:
https://panel.sendcloud.sc/accounts/signup/

Once you have set up an account we advice you to setup your payment contract:
https://panel.sendcloud.sc/#/settings/financial/payments/direct-debit
Registering your payment credentials is necessary to ensure you can make use of the full capabilities of the API.

Once done you can create API keys:
https://panel.sendcloud.sc/#/settings/integrations/api/add
Make sure that you give it a recognizable name. Ensure that you press the save button.

Once saved you should see the Public key and Secret key. Make sure you save them somewhere safely. You are going to need those credentials to authenticate with the API.

Examples

Below you can find the links to Python files which show how to use the API. The scripts are written in Python 3 and require Requests to be installed.
You can easily inspect and learn more about the code.

Running the scripts to interact with the API simple. Take the following create parcel example:

python3 examples/basic_integration_example.py --action create --public XXXXX --secret XXXXX --partner_id YYYYY

You can change action from create to one of the options which you can find in the section below.
Make sure you replace XXXXX by your public and secret key.
You can replace YYYYY by the partner id.
Also can drop the partner_id if you don't have one as it is optional.
At last it is recommended to inspect the code before running it.

Actions

  • basic_integration_example.py
    • create: Create a shipment in SendCloud to be processed.
    • cancel Cancel a shipment in SendCloud before or after processing.
      • NOTE: This action asks for input while executing!

Final note about testing

SendCloud offers no sandbox. If you are testing please notice that there are free and paid shipping options in your account. There is a unstamped label option in the platform which is free and which is recommended for testing.

Once your integration is working you can check with paid shipping methods, but make sure that you cancel them before the cancellation deadline otherwise you have to pay for this label on the next invoice. More info about cancelling a shipment.