Skip to main content

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.

The customer needs an active credit reservation

Store credit only reaches a customer who has an active credit reservation with Walley. Without one, the request is rejected.

Example​

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"
}

Data Model​

Request​

Request headers​

HeaderRequiredExplanation
AuthorizationYesSee Authentication for how to generate the Bearer token value

Request body​

PropertyRequiredExplanationTypeNotes
amountYesThe store credit amount to add to the customer's accountnumberDecimal
actionReferenceYesA unique reference for this action, used for tracking and auditingstringDisplayed in the settlement file
descriptionYesA description of the store credit, such as "Loyalty reward", "Phone trade-in", or "Goodwill compensation"stringDisplayed on future invoices and in the My Walley app
storeIdYesThe store the store credit is associated withnumberIntegers only
integrationIdYesThe 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 codeCodeDescription
400 Bad RequestRESERVATION_NOT_ACTIVEThe customer does not have an active credit reservation
400 Bad RequestREQUEST_INVALIDThe request body failed validation
404 Not FoundNo customer found for the given integrationId and storeId
409 ConflictSTORECREDIT_ALREADY_IN_PROCESSA request with the same idempotency key is already being processed

See Errors for what to do about each of these.

Retry safely with an idempotency key

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.