curl --request POST \
--url https://api.hyperline.co/v1/customers/{id}/credits/{productId}/usage \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"usage_retained": 41,
"event_id": "<string>"
}'
{
"id": "cdt_BPZ19obsBS2qyo",
"product_id": "itm_3kXODDF42QXtnL",
"price": {
"id": "pri_0Jv8EbMDOGsHcn",
"amount": 20000,
"pack_size": 120
},
"customer_id": "cus_Typ0px2W0aiEtl",
"payment_method_id": "pm_1xMpj5bwRqN7LM",
"invoice_id": "inv_1eTaiytfA0i2Va",
"event_id": "<string>",
"expires_at": "<string>",
"type": "topup",
"source": "api",
"amount_excluding_tax": 123,
"credit_count": 32,
"balance_after": 2000,
"created_at": "2024-10-13T07:00:01.860Z",
"updated_at": "2024-10-13T07:00:01.860Z"
}
Create a usage entry for a credit product. This will impact the balance of the customer by usage_retained
.
curl --request POST \
--url https://api.hyperline.co/v1/customers/{id}/credits/{productId}/usage \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"usage_retained": 41,
"event_id": "<string>"
}'
{
"id": "cdt_BPZ19obsBS2qyo",
"product_id": "itm_3kXODDF42QXtnL",
"price": {
"id": "pri_0Jv8EbMDOGsHcn",
"amount": 20000,
"pack_size": 120
},
"customer_id": "cus_Typ0px2W0aiEtl",
"payment_method_id": "pm_1xMpj5bwRqN7LM",
"invoice_id": "inv_1eTaiytfA0i2Va",
"event_id": "<string>",
"expires_at": "<string>",
"type": "topup",
"source": "api",
"amount_excluding_tax": 123,
"credit_count": 32,
"balance_after": 2000,
"created_at": "2024-10-13T07:00:01.860Z",
"updated_at": "2024-10-13T07:00:01.860Z"
}
Bearer authentication header of the form Bearer <token>
, where <token>
is your auth token.
Credit usage entry payload
The body is of type object
.
The created credit transaction
The response is of type object
.
Was this page helpful?