Gift represents a subscription of a customer(recipient) to a 'gift plan' which has been gifted by another customer(gifter). It may also have addons and coupons. Gift will be created only on immediate successful payment collection from the gifter's payment method.
Gift is initially created in 'scheduled' state. The gift can be scheduled to be notified on a particular date to the recipient by passing 'scheduled_at'. If not, the recipient is notified immediately. Gift will be moved to 'unclaimed' state on the date of notification. If you pass auto_claim as true, gift status will be moved to ‘claimed’ immediately, otherwise, the gift will remain 'unclaimed' till the recipient claims the gift.
If the gift is not claimed before the claim_expiry_date, it will be moved to the 'expired' state.
Gift subscriptions will be created in 'future' state. Once the gift is claimed, the subscription will be moved to 'non-renewing' state.
Gift subscriptions will be invoiced immediately. The invoice created has is_gifted as 'true' and term_finalized as 'false'. This is because initially the invoice term_start and term_end are set as the subscription's start_date till the end of the plan period. Once the gift is claimed, the invoice's term_finalized will be marked as 'true'. The term_start will be changed to the actual invoice's term, which is the gift-claim date and the term_end will be changed till plan's period.
{
"auto_claim": false,
"claim_expiry_date": 1525850488,
"gift_receiver": {
"customer_id": "receiver",
"email": "james@user.com",
"first_name": "James",
"last_name": "William",
"object": "gift_receiver",
"subscription_id": "__test__8asuuSB15GTGh"
},
"gift_timelines": [
{
"object": "gift_timeline",
"occurred_at": 1517469689,
"status": "scheduled"
}
],
"gifter": {
"customer_id": "gifter",
"invoice_id": "__demo_inv__1",
"object": "gifter",
"signature": "Sam"
},
"id": "__test__8asuuSB15GYVo__test__sfsBDu8yg3K6cFiTkMu3cdNcF5Hz9NufM",
"no_expiry": false,
"object": "gift",
"resource_version": 1517469689000,
"scheduled_at": 1518074488,
"status": "scheduled",
"updated_at": 1517469689
}
scheduled_at
. If the gift is not claimed within claim_expiry_date
, it will expire and the subscription will move to cancelled
state. When not passed, the value specified in the site settings will be used.
Pass as NULL
or do not pass when auto_claim
or no_expiry
are set. curl https://{site}.chargebee.com/api/v2/gifts/create_for_items \ -u {site_api_key}:\ -d scheduled_at=1518074488 \ -d gifter[customer_id]="gifter" \ -d gifter[signature]="Sam" -d gift_receiver[customer_id]="receiver" \ -d gift_receiver[first_name]="James" \ -d gift_receiver[last_name]="William" \ -d gift_receiver[email]="james@user.com" -d subscription_items[item_price_id][0]="basic-USD" \ -d subscription_items[quantity][0]=2 \ -d subscription_items[item_price_id][1]="day-pass-USD"
scheduled_at
. If the gift is not claimed within claim_expiry_date
, it will expire and the subscription will move to cancelled
state. When not passed, the value specified in the site settings will be used.
Pass as NULL
or do not pass when auto_claim
or no_expiry
are set. curl https://{site}.chargebee.com/api/v2/gifts/__test__KyVnHhSBWTKhSAD__test__XF08jFEYWbAon3fSbc3IriS1N4UNhacdS \ -u {site_api_key}:
curl https://{site}.chargebee.com/api/v2/gifts \ -G \ -u {site_api_key}:\ --data-urlencode limit=2 \ --data-urlencode status[is]="scheduled"
curl https://{site}.chargebee.com/api/v2/gifts/__test__KyVnHhSBWTK3l9N__test__ydFDqluaE3CT6DkcdbI5SNhpzjXlrnh5G/claim \ -X POST \ -u {site_api_key}:
curl https://{site}.chargebee.com/api/v2/gifts/__test__KyVnHhSBWTJsq9A__test__Y3tQPFRGBG1DZEFsDztdQMlBxpQcdkTcdM/cancel \ -X POST \ -u {site_api_key}:
curl https://{site}.chargebee.com/api/v2/gifts/__test__KyVnHhSBWTKnYAO__test__KdVPIxcd0gzgN1seidYQtm0ScuBcUgc3av/update_gift \ -u {site_api_key}:\ -d comment="Customer called and requested the change." \ -d scheduled_at=1517587891