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 SUBSCRIPTION
Gift subscriptions will be created in 'future' state. Once the gift is claimed, the subscription will be moved to 'non-renewing' state.
INVOICE
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.
scheduledGift has been scheduled.unclaimedGift is not yet claimed and is ready to be claimed.claimedGift is claimed.cancelledGift is cancelled.expiredGift is expired.
scheduled_at
optional, timestamp(UTC) in seconds Indicates the date on which the gift notification is sent to the receiver. If not passed, the receiver is notified immediately.
auto_claim
boolean, default=false When true, the claim happens automatically. When not passed, the default value in the site settings is used.
no_expiry
boolean When true, indicates that the gift does not expire. Do not pass or pass as false when auto_claim is set.
claim_expiry_date
optional, timestamp(UTC) in seconds The date until which the gift can be claimed. Must be set to a value after 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.
resource_version
optional, long Version number of this resource. The resource_version is updated with a new timestamp in milliseconds for every change made to the resource. This attribute will be present only if the resource has been updated after 2016-09-28.
updated_at
optional, timestamp(UTC) in seconds Timestamp indicating when this gift resource was last updated.
optional, list of gift_timeline Gift timeline details
Gift timeline attributes
status
enumerated string Status of the gift.
Possible values are
scheduledGift has been scheduled.unclaimedGift is not yet claimed and is ready to be claimed.claimedGift is claimed.cancelledGift is cancelled.expiredGift is expired.
occurred_at
optional, timestamp(UTC) in seconds Timestamp indicating when this event occurred.
Note: This operation optionally supports 3DS verification flow. To achieve the same, create the Payment Intent and pass it as input parameter to this API.
Creates a gift subscription with the gifter and receiver. Only plans marked as gift plans can be used to create gift subscription. It may also have addons and coupons. A gift is initially created in 'scheduled' state and the gift subscription will be created in 'future' state and invoiced immediately.
Term start and term end dates are determined based on whether the gift is claimed. Before claim, term start date is the subscription start date. Term end date occurs at the end of the plan’s frequency. Once the gift is claimed, the gift claim date becomes the term start date and the term end date will be set as the end of the plan’s frequency.
optional, timestamp(UTC) in seconds Indicates the date on which the gift notification is sent to the receiver. If not passed, the receiver is notified immediately.
auto_claim
optional, boolean When true, the claim happens automatically. When not passed, the default value in the site settings is used.
no_expiry
optional, boolean When true, indicates that the gift does not expire. Do not pass or pass as false when auto_claim is set.
.
claim_expiry_date
optional, timestamp(UTC) in seconds The date until which the gift can be claimed. Must be set to a value after 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.
coupon_ids[0..n]
optional, list of string List of coupons to be applied to this subscription. You can provide coupon ids or coupon codes.
+
gifter
Parameters for gifter
pass parameters as gifter[<param name>]
gifter[customer_id]
required, string, max chars=50 Gifter customer id.
gifter[signature]
required, string, max chars=50 Gifter sign-off name
gifter[note]
optional, string, max chars=500 Personalized message for the gift.
gifter[payment_src_id]
optional, string, max chars=40 Identifier of the payment source
+
gift_receiver
Parameters for gift_receiver
pass parameters as gift_receiver[<param name>]
gift_receiver[customer_id]
required, string, max chars=50 Receiver customer id.
gift_receiver[first_name]
required, string, max chars=150 First name of the receiver as given by the gifter.
gift_receiver[last_name]
required, string, max chars=150 Last name of the receiver as given by the gifter,
gift_receiver[email]
required, string, max chars=70 Email of the receiver. All gift related emails are sent to this email.
+
payment_intent
Parameters for payment_intent
pass parameters as payment_intent[<param name>]
payment_intent[id]
optional, string, max chars=150 Identifier for PaymentIntent generated by Chargebee.js. Applicable only when you are using Chargebee.js for completing the 3DS flow. The PaymentIntent should be in 'authorized' state while passing it here. You need not pass other PaymentIntent parameters if this is passed.
payment_intent[gateway_account_id]
required if payment intent token provided, string, max chars=50 The gateway account used for performing the 3DS flow.
payment_intent[gw_token]
optional, string, max chars=65k Identifier for 3DS transaction/verification object at the gateway. Can be passed only after successfully completing the 3DS flow. Refer 3DS implementation in Chargebee to find out the gateway-specific gw_token format. Applicable when you are using gateway APIs directly for completing the 3DS flow.
payment_intent[payment_method_type]
optional, enumerated string The list of payment method types (For example, card, ideal, sofort, bancontact, etc.) this Payment Intent is allowed to use. If payment method type is empty, Card is taken as the default type for all gateways except Razorpay.
optional, string, max chars=65k Identifier for Braintree permanent token. Applicable when you are using Braintree APIs for completing the 3DS flow.
payment_intent[additional_information]
optional, jsonobject
checkout_com: While adding a new payment method using permanent token or passing raw card details to Checkout.com, document ID and country_of_residence are required to support payments through dLocal.
payer: User related information.
country_of_residence: This is required since the billing country associated with the user’s payment method may not be the same as their country of residence. Hence the user’s country of residence needs to be specified. The country code should be a two-character ISO code.
bluesnap: While passing raw card details to BlueSnap, if fraud_session_id is added, additional validation is performed to avoid fraudulent transactions.
braintree: While passing raw card details to Braintree, your fraud_merchant_id and the user’s device_session_id can be added to perform additional validation and avoid fraudulent transactions.
fraud: Fraud identification related information.
device_session_id: Session ID associated with the user's device.
fraud_merchant_id: Your merchant ID for fraud detection.
chargebee_payments: While passing raw card details to Chargebee Payments, if fraud_session_id is added, additional validation is performed to avoid fraudulent transactions.
fraud: Fraud identification related information.
fraud_session_id: Your Chargebee Payments fraud session ID required to perform anti-fraud validation.
+
shipping_address
Parameters for shipping_address
pass parameters as shipping_address[<param name>]
shipping_address[first_name]
optional, string, max chars=150 The first name of the contact.
shipping_address[last_name]
optional, string, max chars=150 The last name of the contact.
shipping_address[email]
optional, string, max chars=70 The email address.
shipping_address[company]
optional, string, max chars=250 The company name.
shipping_address[phone]
optional, string, max chars=50 The phone number.
shipping_address[line1]
optional, string, max chars=150 Address line 1
shipping_address[line2]
optional, string, max chars=150 Address line 2
shipping_address[line3]
optional, string, max chars=150 Address line 3
shipping_address[city]
optional, string, max chars=50 The name of the city.
shipping_address[state_code]
optional, string, max chars=50 The ISO 3166-2 state/province code without the country prefix. Currently supported for USA, Canada and India. For instance, for Arizona (USA), set state_code as AZ (not US-AZ). For Tamil Nadu (India), set as TN (not IN-TN). For British Columbia (Canada), set as BC (not CA-BC).
shipping_address[state]
optional, string, max chars=50 The state/province name. Is set by Chargebee automatically for US, Canada and India If state_code is provided.
shipping_address[zip]
optional, string, max chars=20 Zip or postal code. The number of characters is validated according to the rules specified here.
shipping_address[country]
optional, string, max chars=50 The billing address country of the customer. Must be one of ISO 3166 alpha-2 country code.
Note: If you enter an invalid country code, the system will return an error.
Brexit
If you have enabled EU VAT in 2021 or later, or have manually enable the Brexit configuration, then XI (the code for United Kingdom – Northern Ireland) is available as an option.
shipping_address[validation_status]
optional, enumerated string, default=not_validated The address verification status.
Possible values are
not_validatedAddress is not yet validated.validAddress was validated successfully.partially_validThe address is valid for taxability but has not been validated for shipping.invalidAddress is invalid.
+
subscription
Parameters for subscription
pass parameters as subscription[<param name>]
subscription[plan_id]
required, string, max chars=100 Identifier of the plan for this subscription
subscription[plan_quantity]
optional, integer, default=1, min=1 Plan quantity for this subscription
subscription[plan_quantity_in_decimal]
optional, string, max chars=33 Plan Quantity for this subscription in Multi Decimal
+
addons
Parameters for addons. Multiple addons can be passed by specifying unique indices.
pass parameters as addons[<param name>][<idx:0..n>]
addons[id][0..n]
optional, string, max chars=100 Identifier of the addon. Multiple addons can be passed.
addons[quantity][0..n]
optional, integer, default=1, min=1 Quantity of the addon. Applicable for addons with pricing_model other than flat_fee.
addons[quantity_in_decimal][0..n]
optional, string, max chars=33 The decimal representation of the quantity of the addon. Returned for quantity-based plans when multi-decimal pricing is enabled.
optional, integer, default=10, min=1, max=100 The number of resources to be returned.
offset
optional, string, max chars=1000 Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set offset to the value of next_offset obtained in the previous iteration of the API call.
optional, enumerated string filter Status of the gift. Possible values are : scheduled, unclaimed, claimed, cancelled, expired. Supported operators : is, is_not, in, not_in
Example →status[is_not] = "claimed"
+
gift_receiver
Parameters for gift_receiver
pass parameters as gift_receiver[<param name>][<operator>]
gift_receiver[email][operator]
optional, string filter Email of the receiver. All gift related emails are sent to this email. Supported operators : is, is_not, starts_with
Example →gift_receiver[email][is_not] = "john@test.com"
always returned
Resource object representing subscription
next_offset
optional, string, max chars=1000
This attribute is returned only if more resources are present. To fetch the next set of resources use this value for the input parameter “offset”.
Change the date/time at which the gift notification email is to be sent. This only applies to gifts in the scheduled status.
Sample Request
curl https://{site}.chargebee.com/api/v2/gifts/__test__KyVnHhSBWTKnYAO__test__KdVPIxcd0gzgN1seidYQtm0ScuBcUgc3av/update_gift \
-X POST \
-u {site_api_key}:\
-d comment="Customer called and requested the change." \
-d scheduled_at=1517587891
copy
curl https://{site}.chargebee.com/api/v2/gifts/__test__KyVnHhSBWTKnYAO__test__KdVPIxcd0gzgN1seidYQtm0ScuBcUgc3av/update_gift \
-X POST \
-u {site_api_key}:\
-d comment="Customer called and requested the change." \
-d scheduled_at=1517587891
required, timestamp(UTC) in seconds The new date/time at which the gift notification email is to be sent. The value must be greater than current time. If no_expiry is false then the value must also be less than claim_expiry_date.
comment
optional, string, max chars=250 An internal comment for this action. The comments are not retrievable via API and are only available on request via Chargebee Support.