Get started

Sections

Theme switcher

Process a gift card fulfilment from a pre-existing order in the publisher's database.

Header Parameters

Idempotency-Keystring

Accepted for forward compatibility but not currently enforced by the server, so a retry with the same key is processed again. Do not rely on it to prevent duplicates. Deduplicate on your side using your own order reference, and avoid refreshing or replaying payment success pages.

Min length
8
Max length
64
Acceptstring

Media type the client can parse. Always application/json for this API.

Default value
application/json
Enum values:
application/json
Authorizationstring

Body Parameters

orderIdstring Required

Your internal order ID. Spendstream reads the order detail from your connected database using this key.

brand_idinteger Required
user_idinteger Required

Numeric user ID (not UID).

consentinteger

User's consent to purchase (GDPR).

Enum values:
01
currencystring

Defaults to GBP if omitted.

Min length
3
Max length
3
Pattern
^[A-Z]{3}$
amountnumber

Monetary amount in the specified currency.

paymentIDstring

External payment gateway transaction reference.

payment_statusinteger

External payment gateway status.

paymenttypedescriptionstring

Human-readable payment type (e.g. Visa, Mastercard).

paymentTypestring

Machine-readable payment type code.

Response

200
Object

Gift card issued. Response contains the card URL, reference, face value, and expiry.

Response Attributes

user-idstring
brand-idinteger

Brand's numeric Spendstream ID.

promo-idstring
brand-namestring

Human-readable brand name.

giftcard-reference-idstring

Gift-card supplier reference ID. Pass this as transactionid to /giftCardBalanceCheck.

giftcard-urlstring

Branded URL where the user views and redeems their gift card.

giftcard-face-valuenumber
giftcard-cost-valuenumber

Cost to the publisher (may differ from face value if there's a discount).

currencystring

ISO 4217 currency code.

Min length
3
Max length
3
Pattern
^[A-Z]{3}$
discount-percentageinteger
giftcard-expiry-datestring

Expiry date/time. Format YYYY-MM-DD HH:MM:SS.

responseinteger

Echoes the HTTP status code.

400
Object

The gift-card supplier rejected the issuance (insufficient brand stock, invalid denomination, etc.). Response includes the supplier's error message in message and any partial order context.

Response Attributes

user-idstring
brand-idinteger

Brand's numeric Spendstream ID.

promo-idstring
brand-namestring

Human-readable brand name.

giftcard-reference-idstring

Gift-card supplier reference ID. Pass this as transactionid to /giftCardBalanceCheck.

giftcard-urlstring

Branded URL where the user views and redeems their gift card.

giftcard-face-valuenumber
giftcard-cost-valuenumber

Cost to the publisher (may differ from face value if there's a discount).

currencystring

ISO 4217 currency code.

Min length
3
Max length
3
Pattern
^[A-Z]{3}$
discount-percentageinteger
giftcard-expiry-datestring

Expiry date/time. Format YYYY-MM-DD HH:MM:SS.

responseinteger

Echoes the HTTP status code.

401
Object

Authentication failed. Common causes: missing Authorization header, malformed bearer token, token expired (tokens live 10 hours), or — on getToken itself — HMAC signature mismatch due to clock drift or wrong secret.

Response Attributes

messagestring

Human-readable failure reason. Safe to surface to integrators but not end-users.

errorstring

Alternative error message field used by a subset of endpoints (notably getToken and authentication failures). Integrators should check for both message and error when parsing failure responses.

responseinteger

Numeric status code echoing the HTTP status (e.g. 400, 401). Populated on most error paths; a few auth-layer failures omit it.

403
Object

Your publisher account has an IP allow-list and the request came from an address that is not on it. The API checks the caller's IP address on every request once a list exists. Ask Spendstream to add the address, or to clear the list if you do not want the restriction. See IP allow-listing in the guide.

Response Attributes

statusboolean
messagestring
429
Object

Rate limit exceeded. The POST /getToken endpoint is rate-limited to five requests per minute, and the limit is currently shared across all publishers; other endpoints may be throttled at the reverse-proxy layer in response to abusive traffic. Wait and retry with exponential backoff; the Retry-After header tells you the minimum wait in seconds.

Response Attributes

messagestring

Human-readable failure reason. Safe to surface to integrators but not end-users.

errorstring

Alternative error message field used by a subset of endpoints (notably getToken and authentication failures). Integrators should check for both message and error when parsing failure responses.

responseinteger

Numeric status code echoing the HTTP status (e.g. 400, 401). Populated on most error paths; a few auth-layer failures omit it.

Was this section helpful?

POST

/

Select
1

Response

Was this section helpful?