Skip to main content

Products

Admin APIs require authorization token with admin privileges. You check the following link to generate authorization token. You need to provide admin username and password to generate token with admin privileges.

Authentication

Create Cash Record

This endpoint records a cash payment for a user purchasing a product. It is useful for situations where users make payments offline or outside of Testpress. Upon successful creation of the payment record, the user will automatically gain access to the courses and exams associated with the product. The product's validity and expiry date for that user will be automatically managed.

HTTP Request

POST /api/v2.5/admin/products/<:product-slug>/add-cash-payment/

Fields

NameTypeDescription
user_idintegerID of the Testpress user.
amountinteger/floatPayment amount upto 2 decimal places.
notestringAn optional note that you can add to this cash payment record.
curl --request POST \
--url http://demo.testpress.in/api/v2.5/admin/products/testing-product-1/add-cash-payment/ \
--header 'authorization: JWT eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6MzgsInVzZXJfaWQiOjM4LCJlbWFpbCI6ImRpbmVzaEB0ZXN0cHJlc3MuaW4iLCJleHAiOjE0NzAyMjk2MDd9.ynLE30wWup2CXMqgpNjT4ZBAUAtttqebzat-stuVB84' \
--header 'cache-control: no-cache' \
--header 'content-type: application/json' \
--data '{"user_id": 23, "amount": 999, "note": "Added via API"}'

Response

{
"id": 1892,
"user_id": 23,
"amount": "999.00",
"note": "Added via API",
}