The client will send the product id and quantity of purchase
As a result of calling this API, we need to treat it as a purchase and update the user's purchase metrics.
For crediting points thru Purchase events,
1.The Clients to which products need to be added should enable Allow API. Respective Client Id and Client Secret should be provided in Headers.
2.Customer's Id should be passed in the URL to whom the purchase event is created.
3.Order Id, Order Total, ProductId are mandatory and Order Id should be unique across the client.
4.Client should define earn conversion in the scheme so that order value converts to points with earn conversion and gets credited to the Balance.
Success - Points successfully added.
{
"title": "ok",
"status_code": 0,
"status_message": "Points successfully added for user",
"records": {
"scheme": {
"scheme_id": 31,
"total_points": 900,
"id": 232,
"redeemed_points": 0,
"current_achievements": null,
"level_id": 54,
"user_id": 126,
"region": null,
"club_id": 60,
"created_at": "2021-04-21T19:18:45.000+05:30",
"updated_at": "2021-05-06T13:53:46.000+05:30"
},
"transaction": {
"id": 51,
"client_id": 22,
"user_id": 126,
"scheme_id": 31,
"action": "credit",
"transaction_type": "PurchaseEventOrder",
"transaction_id": 32,
"points": 900,
"remaining_points": 900,
"created_at": "2021-05-06T13:53:46.000+05:30",
"updated_at": "2021-05-06T13:53:46.000+05:30",
"event_type_id": null
}
}
}
Error - User not part of scheme
{
"title": "errors",
"status_code": 1,
"status_message": "User not part of scheme",
"records": []
}
Error - Scheme not found
{
"title": "errors",
"status_code": 1,
"status_message": "Scheme not found",
"records": []
}
Error - Product not found
{
"title": "errors",
"status_code": 1,
"status_message": "Product with id not found in client catalog",
"records": []
}
Error - Duplicate order id
{
"title": "errors",
"status": "bad_request",
"status_message": [
"External order Duplicate Order ID"
],
"records": []
}