from dub import Dub
from dub.models import operations
with Dub(
token="DUB_API_KEY",
) as d_client:
res = d_client.track.sale(request={
"amount": 996500,
"payment_processor": operations.PaymentProcessor.CUSTOM,
})
assert res is not None
# Handle response
print(res)
{
"eventName": "<string>",
"customer": {
"id": "<string>",
"name": "<string>",
"email": "<string>",
"avatar": "<string>",
"externalId": "<string>"
},
"sale": {
"amount": 123,
"currency": "<string>",
"paymentProcessor": "<string>",
"invoiceId": "<string>",
"metadata": {}
}
}
Track a sale for a short link.
from dub import Dub
from dub.models import operations
with Dub(
token="DUB_API_KEY",
) as d_client:
res = d_client.track.sale(request={
"amount": 996500,
"payment_processor": operations.PaymentProcessor.CUSTOM,
})
assert res is not None
# Handle response
print(res)
{
"eventName": "<string>",
"customer": {
"id": "<string>",
"name": "<string>",
"email": "<string>",
"avatar": "<string>",
"externalId": "<string>"
},
"sale": {
"amount": 123,
"currency": "<string>",
"paymentProcessor": "<string>",
"invoiceId": "<string>",
"metadata": {}
}
}
Default authentication mechanism
A sale was tracked.
The response is of type object
.