Our platform enables partners to create bill with payment links for their clients and send them to the email addresses associated with their Forguard accounts.
This process is facilitated through Stripe.
Here's how it works:
Client Billing API enables partners to perform various operations seamlessly. It allows:
With these capabilities, partners can efficiently manage payment processes and track the status of invoices issued to their clients.
Partners need a Stripe account to obtain their API Secret key, essential for conducting Client Billing operations. This key is located in the Developers section of the Stripe account. It's important to disable Test mode to generate a live Secret API key.
Once the API Secret key is linked to the partner account (Partner Panel account), partners gain the ability to create bills with payment links for their clients. They can specify the currency, describe products, assign quantities and prices, which will be reflected in the bill received by their client.
This endpoint allows to retrieve information about Stripe secret key associated with the Partner Panel account.
GET /billing/secret-key
Required field passed in the request:
app_id - The ID of the application assigned to the client account.
Currently, it is only Forguard (Forguard app_id: b901da51-ce00-4af2-b978-8d0fca8ae1ea).
Request example:
curl -X 'GET' \
'https://api.gps-trace.com/billing/secret-key?app_id=b901da51-ce00-4af2-b978-8d0fca8ae1ea' \
-H 'accept: application/json' \
-H 'X-AccessToken: <your token>'
200 Response example:
{
"data": {
"id":number,
"stripe_partner": {
"secret_key": "string",
"webhook_id": "string",
"webhook_secret": "string"
}
}
}
Partners need a Stripe account to obtain their API Secret key, essential for conducting Client Billing operations. This key is located in the Developers section of the Stripe account.
It's important to disable Test mode to generate a live Secret API key.
Once the API Secret key is linked to the partner account (Partner Panel account), partners gain the ability to create bills with payment links for their clients. They can specify the currency, describe products, assign quantities and prices, which will be reflected in the bill received by their client.
This endpoint enables partners to associate their Stripe account's API Secret key with their Partner Panel account. This key is crucial for performing Client Billing operations.
POST /billing/secret-key
The request body must include the following mandatory fields:
Request example:
curl -X 'POST' \
'https://api.gps-trace.com/billing/secret-key' \
-H 'accept: application/json' \
-H 'X-AccessToken: <your token>' \
-H 'Content-Type: application/json' \
-d '{
"app_id": "b901da51-ce00-4af2-b978-8d0fca8ae1ea",
"secretKey": "string"
}'
201 Body response example:
{
"data": {
"id":number,
"stripe_partner": {
"secret_key": "string",
"webhook_id": "string",
"webhook_secret": "string"
}
}
}
This endpoint allows partners to retrieve bill information about Forguard client accounts within a specified time frame.
This method is crucial for tracking and managing client billing activities for accounts billed using the Stripe API Secret key.
GET /billing/stripe-payments
Mandatory request fields:
Note: Results are returned for a maximum duration of 31 days from the begin timestamp.
Request example:
curl -X 'GET' \
'https://api.gps-trace.com/billing/stripe-payments?app_id=b901da51-ce00-4af2-b978-8d0fca8ae1ea&from=<begin timestamp>&to=<end timestamp>&account_id=<account id>&fields=' \
-H 'accept: application/json' \
-H 'X-AccessToken: <your token>'
200 response example:
{
"data": {
"string": {
"id": "string",
"status": "open",
"payment_status": "string",
"created": number,
"expires_at": number,
"account_id": number,
"url": "<link for payment>",
"metadata": {
"app_id": "b901da51-ce00-4af2-b978-8d0fca8ae1ea",
"cid": "string",
"email": "string",
"lang": "string",
"name": "string",
"td_cid": "string"
},
"amount_total": number
},
"string": {
"id": "string",
"status": "string",
"payment_status": "string",
"created": number,
"expires_at": number,
"account_id": number,
"url": null,
"metadata": {
"app_id": "b901da51-ce00-4af2-b978-8d0fca8ae1ea",
"cid": "number",
"email": "string@iliken.com",
"lang": "string",
"name": "string",
"td_cid": "string"
},
"amount_total": number
},...
}
}
}
The response returns a list with the payment ID as the key and the payment information as the value.
This endpoint allows partners to create a bill with a payment link for the client.
The partner specifies the amount, product, currency, and other information to generate the bill.
The response includes the bill details and a payment link. Clients can use this link to pay the bill created by the partner.
Example of the bill issued by the partner, viewed by the client through the payment link:
POST /billing/stripe-payments
Mandatory request fields:
Request example:
curl -X 'POST' \
'https://api.gps-trace.com/billing/stripe-payments' \
-H 'accept: application/json' \
-H 'X-AccessToken: <your token>' \
-H 'Content-Type: application/json' \
-d '{
"app_id": "b901da51-ce00-4af2-b978-8d0fca8ae1ea",
"account_id": number,
"prices": [
{
"quantity": number,
"currency": "string",
"unit_amount": number,
"name": "string"
},
{
"quantity": number,
"currency": "string",
"unit_amount": number,
"name": "string"
}
],
"name": "string"
}
201 response example:
{
"data": {
"id": "string",
"status": "string",
"payment_status": "string",
"created": number,
"expires_at": number,
"account_id": number,
"url": "<link for payment>",
"metadata": {
"app_id": "b901da51-ce00-4af2-b978-8d0fca8ae1ea",
"cid": "string",
"email": "string",
"lang": "string",
"td_cid": "string"
},
"amount_total": number
}
}
The response returns a list with the payment ID as the key and the payment information as the value.
This method sends a payment notification via email to the client associated with the specified payment ID. The email is sent to the email address linked to the Forguard account on which the bill is issued.
The email contains a payment link. When the client clicks on this link, they are directed to a page where they can view the bill issued by the partner, along with its description and all the necessary tools for making the payment.
POST /billing/stripe-payments/{payment_id}/send
Mandatory request fields:
Request example:
curl -X 'POST' \
'https://api.gps-trace.com/billing/stripe-payments/<payment id>/send?app_id=b901da51-ce00-4af2-b978-8d0fca8ae1ea' \
-H 'accept: application/json' \
-H 'X-AccessToken: <your token> ''
Upon a successful request, the response will include a field "result" set to true.
This endpoint allows to forcibly change the status of a client's bill to "expired" .
This method is useful for expiring bills that are no longer relevant or were generated by mistake, without having to wait for the auto-expire process.
POST /billing/stripe-payments/{payment_id}/expire
Mandatory request fields:
Request example:
curl -X 'POST' \
'https://api.gps-trace.com/billing/stripe-payments/<payment_id>/expire' \
-H 'accept: application/json' \
-H 'X-AccessToken: <your token>' \
-H 'Content-Type: application/json' \
-d '{
"app_id": "b901da51-ce00-4af2-b978-8d0fca8ae1ea",
"account_id": <client account id>
}'
200 response example:
{
"data": {
"id": "<payment_id>",
"status": "expired",
"payment_status": "string",
"created": number,
"expires_at": number,
"account_id": number,
"url": null,
"metadata": {
"app_id": "b901da51-ce00-4af2-b978-8d0fca8ae1ea",
"cid": "string",
"email": "string",
"lang": "string",
"name": "string",
"td_cid": "string"
},
"amount_total": number
}
}
This endpoint allows you to retrieve all information about a specific issued bill, including its items.
GET /billing/stripe-payments/{payment_id}/items
Request Parameters:
Request example:
curl -X 'GET' \
'https://api.gps-trace.com/billing/stripe-payments/<payment_id>?app_id=b901da51-ce00-4af2-b978-8d0fca8ae1ea&account_id=<client account id>' \
-H 'accept: application/json' \
-H 'X-AccessToken: <token>'
200 response example:
{
"data": [
{
"id": "string",
"object": "string",
"amount_discount": number,
"amount_subtotal": number,
"amount_tax": number,
"amount_total": number,
"currency": "string",
"description": "string",
"price": {
"id": "string",
"object": "string",
"active": false,
"billing_scheme": "string",
"created": number,
"currency": "string",
"custom_unit_amount": null,
"livemode": false,
"lookup_key": null,
"metadata": {},
"nickname": null,
"product": "string",
"recurring": null,
"tax_behavior": "string",
"tiers_mode": null,
"transform_quantity": null,
"type": "string",
"unit_amount": number,
"unit_amount_decimal": "string"
},
"quantity": number
}
]
}
The response contains an array of data objects. Each object represents an item in the bill with detailed information about the item. Here are the fields included in each item: