Charges
Charges describe what you charge your users for and how much. We show this information to users when subscribing to your API and also use it to ensure only charges of certain amounts are made, this gives users knowledge about how your pricing works.
Static Charges
Static Charges are charges that can only be made once per user request, this allows you to setup a "pay per request" model of payments.
Allows charging per request (i.e £0.003 per request)
Dynamic Charges
Dynamic Charges allow you to change the cost of the charge at the time of your request. This is to account for processing time, MB of data processed etc. A Dynamic Charge requires a cost but also a unit to state how much of the charge was used. This unit is multiplied by the cost to calculate the total cost to the user.
Allows charging based on usage (i.e £0.003 per MB)
Extra Info
Charge Timings
When a charge is made, it is logged on the analytics dashboard in close to realtime, however it may take up to 3 hours for this charge to be shown in the "Available funds" of your account.
Errors
If a charge returns an error ensure to return this error to your user.
If there was an error after a charge has been made causing an invalid response, users are eligible to request the cost of their request back, so ensure your API is working correctly before going live.
Examples
Some examples of using charges in different API scenarios.
PDF to JPG Converter
This API converts PDF files to JPG files through an API, and wants to use PayPI to increase user uptake and reduce development work.
PDF to JPG wants to charge a different fee dependant on the size of the PDF file to convert, but also a fixed fee for each request.
The API uses the following charges to do this:
This then makes a conversion of a 1MB PDF file cost a total of £0.015 (£0.005 + £0.01).
They implement this in their API by passing the API Key in the Authorization header.
Last updated