Add store credit
Use this endpoint to add store credit to a customer's account. Store credit can be used for loyalty rewards, compensation, trade-ins, or other scenarios where the customer should receive credit to use on future purchases.
The transaction will be deducted from the next settlement.
Store credit only reaches a customer who has an active credit reservation with Walley. Without one, the request is rejected.
Exampleβ
- Request
- Response
POST /manage/storecredits HTTP/1.1
Host: api.uat.walleydev.com // Test environment. Production uses a different hostname.
Content-Type: application/json
Authorization: Bearer {{accessToken}}
Walley-Idempotency: 03304b06-cb33-4f78-bcea-86cb4b202ba0
{
"amount": 150.00,
"actionReference": "loyalty-reward-2024-001",
"description": "Loyalty reward",
"storeId": 12345,
"integrationId": "customer-abc-123"
}
HTTP/1.1 202 Accepted
/* No body */
Data Modelβ
Requestβ
Request headersβ
| Header | Required | Explanation |
|---|---|---|
| Authorization | Yes | See Authentication for how to generate the Bearer token value |
Request bodyβ
| Property | Required | Explanation | Type | Notes |
|---|---|---|---|---|
| amount | Yes | The store credit amount to add to the customer's account | number | Decimal |
| actionReference | Yes | A unique reference for this action, used for tracking and auditing | string | Displayed in the settlement file |
| description | Yes | A description of the store credit, such as "Loyalty reward", "Phone trade-in", or "Goodwill compensation" | string | Displayed on future invoices and in the My Walley app |
| storeId | Yes | The store the store credit is associated with | number | Integers only |
| integrationId | Yes | The merchant's identifier for the customer (integration ID) | string |
Responseβ
Adding store credit answers 202 Accepted with an empty body. 202 means Walley accepted the
request, not that it has been applied. See
Asynchronous operations for what that means.
Error responsesβ
| Http status code | Code | Description |
|---|---|---|
400 Bad Request | RESERVATION_NOT_ACTIVE | The customer does not have an active credit reservation |
400 Bad Request | REQUEST_INVALID | The request body failed validation |
404 Not Found | No customer found for the given integrationId and storeId | |
409 Conflict | STORECREDIT_ALREADY_IN_PROCESS | A request with the same idempotency key is already being processed |
See Errors for what to do about each of these.
A response you never receive, because of a network problem for example, leaves you unsure whether the request went through. Retrying it blind risks doing the same thing twice.
Generate a v4 UUID and send it as the Walley-Idempotency header on every unique operation:
Walley-Idempotency: 03304b06-cb33-4f78-bcea-86cb4b202ba0
Retry with the same key and Walley applies the operation only once.