You Got a Gift Processor and API
This page explains the You Got a Gift integration from an operations and customer-service perspective: how an order moves through the system, which settings control it, and what evidence is useful when investigating a failed or delayed gift-card order.
What You Got a Gift does
You Got a Gift is an asynchronous, SKU-per-product order processor with catalogue support. The application creates a provider order using the configured brand product code, parses the returned voucher payload, and can retrieve the same order again by its provider order ID.
The platform treats the integration as asynchronous, but the current interaction validates voucher data on both create and retrieve responses. A response with only an order ID and no usable url or code is therefore a response-validation failure in the current implementation rather than a normal pending response.
| Property | Behaviour |
|---|---|
| Processor type | SKU per product; brand product mapping is required |
| Processing | Asynchronous order creation with order retrieval |
| Delivery | Digital voucher/code or URL |
| Balance lookup | Unsupported |
| Cancellation | Unsupported |
| Order completion rule | Response contains order_id, gift_voucher, and a usable url or code |
Order lifecycle
- A partner orders a You Got a Gift-enabled brand.
- The processor reads the brand's You Got a Gift product/SKU mapping, the requested amount, currency, and the internal sale UUID.
- The currency selects the provider credentials and is converted to the provider country code: for example,
AEDmaps toAE. - The client creates the provider order with the internal transaction reference and
notify: 0. - The interaction requires
order_idandgift_voucherin the response, then extracts the recognised voucher labels:url,code, andpin. - The provider
order_idbecomes the processor reference. The application stores the returned voucher data and marks the sale successful. - If retrieval is requested, the client calls the provider with the stored order ID and parses the same response shape again.
The provider's state and ordered amount may be present in the response and are useful for diagnostics, but they are not the success rule used by the processor. A usable voucher value is required by the parser.
Example API order flow
The following examples are illustrative and contain no real credentials or voucher values.
Create order request
The request is sent as JSON to POST /orders/ relative to the configured base URI:
{
"reference_id": "sale-123e4567-e89b-12d3-a456-426614174000",
"notify": 0,
"brand_code": "ABC12",
"currency": "AED",
"amount": 65.0,
"country": "AE"
}
The reference_id is the internal transaction reference, while brand_code is the provider product code configured for the brand. Authentication headers are generated from the currency-specific API key and secret and must not be copied into support tickets.
Create order response
An order that can be completed by the current parser has this general shape:
{
"reference_id": "sale-123e4567-e89b-12d3-a456-426614174000",
"order_id": 12345,
"state": 1,
"notify": 0,
"ordered_amount": {
"currency": "AED",
"amount": 65
},
"barcode": "https://[redacted]/barcode",
"gift_voucher": [
{
"label": "code",
"value": "1234567890"
},
{
"label": "pin",
"value": "0987 654 321"
}
],
"expiry_date": "2026-08-02"
}
The provider may return a URL instead of a code:
{
"order_id": 12345,
"gift_voucher": [
{
"label": "url",
"value": "https://[redacted]/voucher/[redacted]"
}
],
"expiry_date": "2026-08-02"
}
Retrieve order request and response
Retrieval uses the provider order ID stored as the processor reference:
GET /orders/12345/
The retrieval request has no JSON body. The currency is used to select the correct provider credentials and is included in the internal request data, while the provider order ID is carried in the URL. The response uses the same order_id and gift_voucher structure as the create response.
Response mapping and validation
The interaction maps provider fields to the internal card as follows:
| Provider field or condition | Internal result | Operational meaning |
|---|---|---|
order_id | processor_reference as a string | Identifier used for later retrieval and reconciliation |
gift_voucher[].label = url | Third-party URL | Valid delivery value when no code is returned |
gift_voucher[].label = code | Card code | Valid delivery value; the original code is retained |
gift_voucher[].label = pin | Card PIN | Spaces are removed before storing the PIN |
expiry_date | Expiration date in ISO format | Parsed when present |
barcode plus a code | C128 barcode fields generated by Wrappr | No barcode is generated for URL-only responses |
| Unknown voucher label | Ignored | It does not satisfy the url/code requirement |
For codes containing spaces, the stored code remains the provider value, while the generated barcode string encodes spaces as %20. If a response contains a URL and a PIN but no code, the order remains usable through the URL and an error is logged because the combination is unusual.
The following conditions are validation failures:
order_idis missing or empty.gift_voucheris missing or empty.- A voucher entry has no
labelorvalue. - No recognised
urlorcodeis returned.
Audit comparison fields
Compare create and retrieve interaction audits as a sequence. The application request and response timestamps come from the processor interaction audit; the provider does not supply equivalent application timing fields in the documented request data.
| Field | Create order | Retrieve order | What to verify |
|---|---|---|---|
| Operation | POST /orders/ | GET /orders/{order_id}/ | A new sale starts with create; retrieval reuses the existing provider order |
| Audit transaction reference | Internal sale UUID sent as reference_id | Retrieval transaction reference from the service request | Both audits belong to the expected sale/workflow |
| Request/response timestamps | Audit request and response times | Audit request and response times | The response follows its matching request and the sequence is chronological |
| Provider reference | Not available until response | order_id from the original create response | The retrieval path uses the stored order ID, not a newly generated order |
| Brand product | brand_code | Not sent in the retrieval URL | The create value matches the configured provider product |
| Currency/country | currency and derived country | Currency selects credentials | Currency is supported and the expected credential set was used |
| Amount | amount | Not sent in the retrieval URL | The requested amount matches the sale |
| Voucher data | gift_voucher, optional barcode, expiry_date | Same response fields | A usable url or code is present before completion |
| Response state | state may be present | Provider response field if present | Do not use state alone as the application success criterion |
A redacted comparison record can be represented as follows:
{
"create": {
"operation": "POST /orders/",
"requestTimestamp": "2026-08-17T17:16:04Z",
"responseTimestamp": "2026-08-17T17:16:05Z",
"saleId": "sale-123e4567-e89b-12d3-a456-426614174000",
"referenceId": "sale-123e4567-e89b-12d3-a456-426614174000",
"brandCode": "ABC12",
"currency": "AED",
"country": "AE",
"amount": 65.0,
"orderId": "12345",
"cardDataPresent": true
},
"retrieve": {
"operation": "GET /orders/12345/",
"requestTimestamp": "2026-08-17T17:18:22Z",
"responseTimestamp": "2026-08-17T17:18:23Z",
"saleId": "sale-123e4567-e89b-12d3-a456-426614174000",
"processorReference": "12345",
"orderId": "12345",
"cardDataPresent": true
}
}
Settings
Processor settings
The processor-level settings are environment-backed values in config/you-got-a-gift.php:
| Setting | Environment variable | Purpose |
|---|---|---|
| Base URI | YOUGOTAGIFT_BASE_URI | Base URL for create, retrieve, and catalogue calls |
| Timeout | YOUGOTAGIFT_TIMEOUT | HTTP client timeout |
The client creates an HMAC-SHA256 Signature authorization header from the selected currency's API secret and sends the API key in both the signature key ID and x-api-key header. Do not log or include the API key, secret, or generated authorization header in support evidence.
Currency credentials and country mapping
Credentials are selected from the order currency. The supported currencies and derived provider country codes are:
| Currency | Country | API key environment variable | API secret environment variable |
|---|---|---|---|
AED | AE | YOUGOTAGIFT_AED_API_KEY | YOUGOTAGIFT_AED_API_SECRET |
SAR | SA | YOUGOTAGIFT_SAR_API_KEY | YOUGOTAGIFT_SAR_API_SECRET |
OMR | OM | YOUGOTAGIFT_OMR_API_KEY | YOUGOTAGIFT_OMR_API_SECRET |
KWD | KW | YOUGOTAGIFT_KWD_API_KEY | YOUGOTAGIFT_KWD_API_SECRET |
QAR | QA | YOUGOTAGIFT_QAR_API_KEY | YOUGOTAGIFT_QAR_API_SECRET |
BHD | BH | YOUGOTAGIFT_BHD_API_KEY | YOUGOTAGIFT_BHD_API_SECRET |
Both credentials must be present for the order currency. An unsupported currency fails before the provider request because no currency-to-country mapping exists.
Brand settings
Each enabled brand must have the You Got a Gift product/SKU mapping used by the brand_code field. The mapping is stored in the brand attributes using the issuer's standard SKU attribute format; it is not taken from the order amount at runtime for this processor. A wrong, missing, or stale mapping can create an order for the wrong provider product or cause the provider to reject the request.
Catalogue imports provide the provider's brand_code, accepted currency, and denomination information. Confirm that the imported product is associated with the intended brand and currency before enabling sales.
API operations and rate limits
| Operation | Method and path | Use |
|---|---|---|
| Create order | POST /orders/ | Start a provider order |
| Retrieve order | GET /orders/{order_id}/ | Retrieve the voucher for an existing provider order |
| Brands | GET /brands/ or GET /brands/?page={page} | Import provider catalogue data |
The catalogue endpoint uses the AED credential set by default. Production limits are two calls per day to the catalogue endpoint, and each page may be called twice per day. Avoid repeated manual catalogue requests while investigating an individual sale.
Failure and retry behaviour
The client maps provider failures into interaction exceptions. The platform retries transient failures but does not retry configuration, authentication, or duplicate-order failures automatically:
| Provider condition | Interaction result | Retry behaviour |
|---|---|---|
| Network failure or timeout | RetryableRequestException | Retryable |
HTTP 429 too many requests | RetryableRequestException | Retryable |
HTTP 5xx server error | RetryableRequestException | Retryable |
HTTP 400 malformed request | ProcessorInteractionException | Not retryable without correction |
HTTP 401/403 authentication failure | ProcessorInteractionException | Not retryable without credential correction |
HTTP 404 resource not found | ProcessorInteractionException | Not retryable; verify order ID or catalogue page |
HTTP 409 resource exists | ResourceExistsException | Not a new-order retry; reconcile the existing order |
| Invalid response shape or missing voucher value | ResponseValidationException | Not retryable until the provider response or configuration is understood |
For a duplicate create response or 409, do not submit another create request immediately. Check the create audit and use the existing provider order reference for retrieval or escalation.
Customer-service investigation
For a failed or delayed order, collect the following before re-ordering:
- Internal sale UUID and transaction reference.
- Brand slug, requested amount, delivery method, and currency.
- The configured brand product/SKU mapping and expected
brand_code. - The create-order audit, including request and response timestamps, endpoint, redacted request fields, HTTP result,
order_id, and voucher labels. - Any retrieve-order audits and the processor reference used in the path.
- The currency-specific credential configuration status, without exposing secrets.
Use the first provider operation to classify the problem:
- If
POST /orders/succeeded and returned anorder_id, retrieve that order rather than creating another one. - If create returned an order ID but no usable voucher, treat it as a response-validation or provider-completion issue; do not assume the order is safe to repeat.
- If only
GET /orders/{order_id}/appears, verify that the processor reference came from the original create flow and that the retrieval belongs to the same sale. - If no provider audit exists, investigate processor selection, currency support, brand SKU resolution, and request dispatch before contacting the provider.
- If the provider rejected the create request, compare
brand_code,currency,country, andamountwith the sale and catalogue record.
Limitations and escalation evidence
You Got a Gift balance checks and cancellations are not implemented by this processor. Escalations should include the internal sale identifier, provider order ID if available, currency, timestamps, operation and endpoint, HTTP status or mapped exception, and redacted response structure. Never include API secrets, authorization headers, or unredacted voucher codes and PINs in a ticket.
Related code
app/Processors/YouGotAGift/YouGotAGiftProcessor.php— asynchronous processor wrapper.app/Processors/Interaction/Integrations/YouGotAGift/YouGotAGiftProcessorInteraction.php— create/retrieve request construction, response parsing, and exception classification.app/Http/Clients/YouGotAGift/YouGotAGiftApi.php— provider transport, authentication headers, endpoint paths, and HTTP error mapping.app/Http/Clients/YouGotAGift/Requests/CreateOrderRequestData.php— create request payload.app/Http/Clients/YouGotAGift/Requests/RetrieveOrderRequestData.php— retrieve request data.app/CatalogueService/Jobs/YouGotAGiftPageCollector.php— provider catalogue import and validation.config/you-got-a-gift.php— processor environment settings.tests/Unit/Processors/Interaction/Integrations/YouGotAGift/YouGotAGiftProcessorInteractionTest.php— request mapping, voucher parsing, validation, and retry scenarios.