» Gift Certificate PATCH API Documentation
» Gift Certificate PATCH API Documentation

Endpoint: PATCH /api/v3/gift_certificates/{uuid}

Purpose

This endpoint is used to update the details of an existing gift certificate by providing its UUID. It enables modifications to key fields such as accounting code, expiry date, and custom attributes. The certificate's code can also be regenerated based on a new prefix and length if specified.

Use Case

A business administrator can update a gift certificate's details to align with changes, such as extending the expiry date, adjusting custom attributes for personalized promotions, or rebranding the gift certificate code for better tracking.

Path Parameters

ParameterTypeDescription
uuidstringThe unique identifier of the gift certificate to be updated.

Request

The request body allows updating the gift certificate's key details, such as its accounting code, expiry date, and custom attributes. You can optionally regenerate the gift certificate code using a new prefix and length. This flexibility helps align the certificate with changing requirements or rebranding efforts.

{
    "gift_certificate": {
        "accounting_code": "ACCOUNTING_CODE",
        "expiry_date": "YYYY-MM-DD",
        "code": {
            "length": "CODE_LENGTH",
            "prefix": "CODE_PREFIX"
        },
        "custom_attributes": [
            {
                "name": "ATTRIBUTE_NAME",
                "value": "ATTRIBUTE_VALUE"
            }
        ]
    }
}

Response

The response confirms the updated gift certificate details, reflecting the changes made. It includes revised metadata (expiry date, custom attributes, and code if regenerated), ensuring the system and stakeholders are aligned with the updated state of the certificate.

{
    "gift_certificate": {
        "status": "STATUS_PLACEHOLDER",
        "accounting_code": "ACCOUNTING_CODE",
        "code": "CODE_PLACEHOLDER",
        "amount": "AMOUNT_PLACEHOLDER",
        "remaining_balance": "BALANCE_PLACEHOLDER",
        "used_amount": "USED_AMOUNT_PLACEHOLDER",
        "currency": "CURRENCY_PLACEHOLDER",
        "expiry_date": "YYYY-MM-DDTHH:MM:SSZ",
        "created_by": "CREATOR_PLACEHOLDER",
        "created_on": "YYYY-MM-DDTHH:MM:SSZ",
        "last_updated_by": "UPDATER_PLACEHOLDER",
        "last_updated_on": "YYYY-MM-DDTHH:MM:SSZ",
        "uuid": "UUID-PLACEHOLDER",
        "custom_attributes": [
            {
                "attribute": {
                    "id": "ATTRIBUTE_ID",
                    "name": "ATTRIBUTE_NAME"
                },
                "value": "ATTRIBUTE_VALUE"
            }
        ],
        "allocations": [
            {
                "date": "YYYY-MM-DDTHH:MM:SSZ",
                "type": "TYPE_PLACEHOLDER",
                "account": "ACCOUNT_PLACEHOLDER"
            }
        ],
        "transactions": [
            {
                "date": "YYYY-MM-DDTHH:MM:SSZ",
                "type": "TRANSACTION_TYPE_PLACEHOLDER",
                "accounting_code": "ACCOUNTING_CODE",
                "amount": "TRANSACTION_AMOUNT_PLACEHOLDER",
                "currency": "CURRENCY_PLACEHOLDER",
                "reference": "REFERENCE_PLACEHOLDER"
            }
        ]
    }
}