Skip to content

Examples

Here are some examples which help you to get started with the library.

Initiate

You can initiate the client with or without request params.

See Also

Code Reference: Client

client.py
1
2
3
from plisio import Client

client = Client("<API_KEY>")
client.py
1
2
3
4
import asyncio
from plisio import AsyncClient

client = AsyncClient("<API_KEY>")
with_request_params.py
1
2
3
4
5
from plisio import Client

client = Client("<API_KEY>", requests_params={
    "timeout": 10
})
async_with_request_params.py
1
2
3
4
5
6
import asyncio
from plisio import AsyncClient

client = AsyncClient("<API_KEY>", requests_params={
    "timeout": 10
})

Transactions

Query transactions.

See Also

Sync Code Reference: Client.transactions Async Code Reference: AsyncClient.transactions

API Reference: Transactions

get_transactions.py
1
2
3
4
5
6
7
def main():
    transactions = client.transactions()

    print(transactions)


main()
get_transactions.py
1
2
3
4
5
6
7
async def main():
    transactions = await client.transactions()

    print(transactions)


asyncio.run(main())
output
{'status': 'success', 'data': {'operations': [], '_links': {'self': {'href': 'https://plisio.net/api/v1/operations?api_key=By3QOfFqVu3w8mH7BZm5QO3T-Gq4fVnAaaCz790zFoLVamWWsR24ON_HlGUbjScd&page=1&per-page=10'}}, '_meta': {'totalCount': 0, 'pageCount': 0, 'currentPage': 1, 'perPage': 10}}}

Create Invoice

Create an invoice.

See Also

Sync Code Reference: Client.invoice Async Code Reference: AsyncClient.invoice

API Reference: Create Invoice

create_invoice.py
def main():
    invoice = client.invoice(
        order_name="test",
        order_number="test",
        amount=1,
        currency="BTC",
    )

    print(invoice)


main()
create_invoice.py
async def main():
    invoice = await client.invoice(
        order_name="test",
        order_number="test",
        amount=1,
        currency="BTC",
    )

    print(invoice)


asyncio.run(main())
output
{'status': 'success', 'data': {'txn_id': '6470c20600b6719c3f063d59', 'invoice_url': 'https://plisio.net/invoice/6470c20600b6719c3f063d59', 'invoice_total_sum': '1.00000000'}}