Gift Card Callbacks

Signed commission and catalogue updates for your API integration.

Keep your Gift Card catalogue and package commission in sync with signed Pay2New callbacks. Configure these callbacks in your partner panel; they are separate from your existing transaction callback URL.

Configure your callback

  1. Sign in to Pay2New → Developer → API Credentials.
  2. Under Gift Card callbacks, enter your public HTTPS endpoint on port 443.
  3. Select Commission updates, Catalogue updates, or both; enable callbacks and save.
  4. Copy the dedicated Gift Card signing secret into your receiving backend's private environment. This is a separate secret from your API authentication credential.
  5. Fetch List Gift Card Brands as your initial baseline. Then use Send test callback and inspect Recent deliveries.

Delivery requires an active API account, verified KYC, active wallet, and an active Gift Card service. You can save an endpoint before activation, but notifications are not sent until access is active. No historical event replay is performed when you first subscribe or change settings.

Only public HTTPS endpoints on port 443 are supported. Private/loopback/link-local addresses, URL credentials, fragments and redirects are not allowed. DNS is checked on every attempt and the connection is pinned to a checked public address. Enabling an endpoint performs DNS validation but does not send an HTTP probe. Disabling remains possible when its DNS is unavailable.

Events

EventMeaningReceiver action
giftcard.commission.updatedYour account's package commission for a product changed, including becoming unavailable.Update/invalidate that product's cached commission; refresh /brands and obtain /quote before a purchase.
giftcard.catalogue.updatedA public product was added, changed, reactivated or became unavailable. Includes changes to available brand details, denominations/limits, artwork URLs, categories, validity and redemption/terms content.Refresh /brands; for an active product also refresh /brands/{product_code}. Remove/disable cached entries when status is INACTIVE.
giftcard.webhook.testA manually requested connectivity/signature test.Verify, record and acknowledge it. It creates no order or wallet debit.

Changes are checked approximately every minute after database updates commit. Rapid intermediate changes can be combined into the latest observed state; this is a cache-update feed, not a complete rate history. Identical snapshots do not generate repeated update events. A provider rate change that does not change your own package commission does not trigger a commission event for your account.

Each account receives only its own commission. Callback payloads do not include provider margins, provider credentials, customer details or voucher credentials. These events are not order-status notifications; continue using Gift Card Order Status for orders.

Request headers and signature

Callbacks are sent as HTTP POST with a JSON body.

HeaderValue
Content-Typeapplication/json
User-AgentPay2New-GiftCard-Webhooks/1.0
X-Pay2New-Event-IdThe immutable event ID, also present as body id.
X-Pay2New-TimestampUnix timestamp in seconds for this delivery attempt.
X-Pay2New-Signaturev1= followed by the lowercase hexadecimal HMAC-SHA256 digest.

Compute the expected signature using your dedicated Gift Card signing secret as the literal UTF-8 string, including its whsec_ prefix:

signed_message = timestamp_header + "." + raw_HTTP_request_body
expected_signature = "v1=" + HMAC_SHA256_HEX(signing_secret, signed_message)

Verify the exact raw request bytes, before decoding JSON. Do not parse and reserialize the body before verification. Use a constant-time comparison, require a timestamp within 300 seconds of your server's current time, and keep your server clock synchronized. Check that X-Pay2New-Event-Id equals the JSON body id, then enforce your expected environment and supported event types.

Never put the signing secret in a query string, browser bundle or mobile application. Pay2New sends the signature, not the signing secret or your API authentication header.

Common envelope

FieldTypeDescription
idstringUnique gc_evt_... event ID. Use as a durable deduplication key.
typestringOne of the event types above.
schema_versionstringCurrently 1.0.
created_atstringEvent creation time in RFC3339 UTC. Stable across retries.
environmentstringproduction or uat.
revisionintegerMonotonically increasing observed-state revision. Compare within environment + event type + product code. Test events use 0. Revisions are not necessarily consecutive for a product.
dataobjectEvent-specific fields below.

Delivery order is not guaranteed. Discard an older revision after a newer revision for the same environment/type/product has been applied, or simply refetch the latest authenticated API data on each verified notification.

Commission update example

{
  "id": "gc_evt_0123456789abcdef0123456789abcdef",
  "type": "giftcard.commission.updated",
  "schema_version": "1.0",
  "created_at": "2026-10-17T07:30:00Z",
  "environment": "production",
  "revision": 4,
  "data": {
    "product_code": 1004335,
    "name": "Zomato Fixed",
    "previous_commission": { "type": "percentage", "min": 2.8, "max": 2.8 },
    "partner_commission": { "type": "percentage", "min": 3, "max": 3 },
    "catalogue_url": "https://pay2new.in/apis/v1/giftcards/brands",
    "quote_url": "https://pay2new.in/apis/v1/giftcards/quote"
  }
}

Rates and the product above are illustrative. partner_commission and previous_commission use the same shape as the catalogue: type is percentage or fixed, and min/max indicate the applicable rate range across configured slabs. A percentage value of 3 means 3%, not 0.03%. Fixed values are INR amounts. null means no unambiguous available commission; never interpret null as a confirmed 0% rate. Use an amount-specific quote for final commission, taxes and wallet debit.

Catalogue update example

{
  "id": "gc_evt_fedcba9876543210fedcba9876543210",
  "type": "giftcard.catalogue.updated",
  "schema_version": "1.0",
  "created_at": "2026-10-17T07:31:00Z",
  "environment": "production",
  "revision": 7,
  "data": {
    "change": "updated",
    "product_code": 1004335,
    "name": "Zomato Fixed",
    "status": "ACTIVE",
    "catalogue_url": "https://pay2new.in/apis/v1/giftcards/brands",
    "brand_url": "https://pay2new.in/apis/v1/giftcards/brands/1004335"
  }
}

change is created, updated or deactivated; reactivation is reported as created. status is ACTIVE or INACTIVE. This event intentionally signals invalidation instead of embedding a potentially stale full catalogue. The product-specific details endpoint can report unavailable after deactivation; refresh the complete brand list to reconcile removals. Preserve your historical transaction/operator references when disabling a product.

PHP signature verification

The function below verifies and parses a callback. Call it with the raw body from php://input and header values from your framework. Keep the signing secret in a private environment variable. This function performs verification only; integrate durable deduplication/queueing before returning HTTP 2xx.

function verifyPay2NewGiftCardCallback(
    string $raw,
    string $timestamp,
    string $signature,
    string $eventId,
    string $secret,
    string $expectedEnvironment = 'production'
): array {
    if ($secret === '' || !ctype_digit($timestamp)
        || strlen($timestamp) > 11 || abs(time() - (int)$timestamp) > 300) {
        throw new RuntimeException('Invalid callback timestamp or configuration');
    }
    $expected = 'v1=' . hash_hmac('sha256', $timestamp . '.' . $raw, $secret);
    if (!hash_equals($expected, $signature)) {
        throw new RuntimeException('Invalid callback signature');
    }
    $event = json_decode($raw, true, 64, JSON_THROW_ON_ERROR);
    $types = ['giftcard.commission.updated', 'giftcard.catalogue.updated', 'giftcard.webhook.test'];
    if (!is_array($event) || ($event['id'] ?? '') !== $eventId
        || !preg_match('/\Agc_evt_[a-f0-9]{32}\z/', $eventId)
        || ($event['environment'] ?? '') !== $expectedEnvironment
        || ($event['schema_version'] ?? '') !== '1.0'
        || !in_array($event['type'] ?? '', $types, true)) {
        throw new RuntimeException('Unsupported callback envelope');
    }
    return $event;
}

Receiver workflow:

  1. Accept only POST, apply a reasonable body-size limit, and verify the signature and timestamp.
  2. Persist/enqueue the event with a unique constraint on id. A duplicate already durably accepted may be acknowledged again.
  3. Return HTTP 200 or 204 quickly, within the delivery timeout.
  4. Process your queue, compare revisions and fetch the latest Pay2New catalogue/quote using your normal backend API credentials and registered outbound IP.

If storage/queueing fails, return a non-2xx response so delivery can retry. A valid signature does not authorize any purchase or wallet movement by your receiver.

Delivery, retries and settings changes

  • Any HTTP 2xx acknowledges delivery; no particular response JSON is required. Redirects are not followed.
  • Connect timeout is 3 seconds; the total attempt timeout is 8 seconds.
  • Initial delivery plus up to five automatic retries: approximately 1 minute, 5 minutes, 15 minutes, 1 hour and 4 hours after the preceding failure. Scheduler load can delay attempts.
  • Automatic retry exhaustion is shown as FAILED. Use Retry in Recent deliveries for a new retry cycle, after fixing your receiver.
  • Event ID, body and revision remain identical across automatic/manual retries. Delivery timestamp and signature are regenerated per attempt. Delivery is at least once; implement deduplication.
  • Recent deliveries shows the latest 15 events with status, attempt count and HTTP status. Response bodies and signing secrets are not included in delivery logs. Times in the partner panel are shown in IST.
  • Disabling callbacks, changing URL/event selections or rotating the signing secret cancels pending/failed deliveries for the previous configuration. A request already in progress may finish. Sync the latest catalogue after every configuration change.
  • Rotating this secret affects only Gift Card callbacks; it does not rotate your API authentication credentials or existing transaction callback configuration.
  • If your API/service access is revoked or expired, delivery is stopped. After access is restored, refetch the full catalogue; do not assume missed catalogue events will be replayed.

Keep purchase-time validation

Callbacks improve cache freshness; periodic full catalogue sync remains useful for recovery. Always request Gift Card Quote before confirmation, then submit expected_wallet_debit with Purchase Gift Card. A commission/catalogue callback never reprices historical transactions and never creates an order, debit or refund.