Billings

Billings can then be triggered at the end of each cycle from the webapp or the 8Pay Javascript library.

Billings can fail if the subscriber hasn’t got enough funds on his wallet, hasn’t enabled the token or his spending limit fo the token is too low. They can be retried at a later time.

get
Get billings of a plan

https://api.8pay.network/v1/bsc/variable-recurring/plans/:planId/billings
Request
Response
Request
Path Parameters
planId
required
string
ID of the plan
Headers
Authorization
required
string
API key
Query Parameters
triggeredBy
optional
string
filter by the user who triggered the billing
from
optional
number
filter by timestamp (default 0)
to
optional
number
filter by timestamp (default current timestamp)
sort
optional
string
asc or desc based on timestamp (default desc)
Response
200: OK
{
"data": [
{
"subscriptionId": "0xe63ba761797e289076f80a7c0916a31740684806aaf507da85f81ee785fec6ba",
"success": 1,
"amount": "10",
"fee": "0.001",
"token": "8PAY",
"receiver": "0x5A4278004294D3C8Ba351c2533951A79EE48D9b8",
"timestamp": 1571646052,
"cycleStart": 1571646052,
"cycleEnd": 1571732452,
"triggeredBy": "0xe42fD8a58A82fDF624A8a94dA03a0e44F9934Dff",
"transactionHash": "0xbb97a142aed61a7027b0a030f3c0ab7e1b39bb776201752829d96d562ed49782",
"transactionStatus": "confirmed"
}
],
"limit": 100,
"offset": 0,
"total": 1
}

get
Get billings of a subscription

https://api.8pay.network/v1/bsc/variable-recurring/subscriptions/:subscriptionId/billings
Request
Response
Request
Path Parameters
subscriptionId
required
string
ID of the subscription
Headers
Authorization
required
string
API key
Query Parameters
from
optional
number
filter by timestamp (default 0)
to
optional
number
filter by timestamp (default current timestamp)
sort
optional
string
asc or desc based on timestamp (default desc)
Response
200: OK
{
"data": [
{
"subscriptionId": "0xe63ba761797e289076f80a7c0916a31740684806aaf507da85f81ee785fec6ba",
"success": 1,
"amount": "10",
"fee": "0.001",
"token": "8PAY",
"receiver": "0x5A4278004294D3C8Ba351c2533951A79EE48D9b8",
"timestamp": 1571646052,
"cycleStart": 1571646052,
"cycleEnd": 1571732452,
"triggeredBy": "0xe42fD8a58A82fDF624A8a94dA03a0e44F9934Dff",
"transactionHash": "0xbb97a142aed61a7027b0a030f3c0ab7e1b39bb776201752829d96d562ed49782",
"transactionStatus": "confirmed"
}
],
"limit": 100,
"offset": 0,
"total": 1
}