Caution
Using any kind of automation programs on your account can result in your account getting permanently banned by Saweria. Use at your own risk.
$ pip install saweriaqris Install this package
use this within your code example below
creating a code
from saweriaqris import create_payment_qr, paid_status
myqr = create_payment_qr("nindtz", 10000, "Budi", "budi@saweria.co", "Semangat!")
qrcode = myqr[0]
transaction_id = myqr[1]
# Just feed the qrcode to your favourite qr code generator
# transaction_id for matching purpose to your webhook callschecking transaction status
from saweriaqris import create_payment_qr, paid_status
is_paid = paid_status(transaction_id)
# is_paid is bool valueTip
Best Practice: You are supposed to use Saweria's Webhook Integration to get realtime payment notification to your API.
- Set your Saweria Integration to point to your API (found in Integrations -> Webhook)
- You issue a payment code to your client.
- After successful payment, Saweria will do POST request (Webhook) to your API. Below example POST from Saweria Webhook:
{
"version": "2022.01",
"created_at": "2021-01-01T12:00:00+00:00",
"id": "00000000-0000-0000-0000-000000000000",
"type": "donation",
"amount_raw": 69420,
"cut": 3471,
"donator_name": "Someguy",
"donator_email": "someguy@example.com",
"donator_is_user": false,
"message": "THIS IS A FAKE MESSAGE! HAVE A GOOD ONE",
"etc": {
"amount_to_display": 69420
}
}- Parse the JSON from the POST and challenge the id given from Saweria Webhook with the paid_status function.
- Only after it returns True, then you can update accordingly.
