Sample promotional credit [ JSON ]

{ "id": "3Nl8LcOQWK2jMp74", "customer_id": "4gkYnd21ouvW", "type": "increment", "amount": 1000, "description": "Promotional credits added", "credit_type": "general", "closing_balance": 1000, "done_by": "rr@mannar.com", "created_at": 1506418553, "object": "promotional_credit", "currency_code": "USD" }

API Index URL GET

https://{site}.chargebee.com/api/v2/promotional_credits
id
Unique reference ID provided for promotional credits.
string, max chars=150
customer_id
Identifier of the customer.
string, max chars=50
type
Type of promotional credits.
enumerated string
Possible values are
incrementIncrement.decrementDecrement.
amount
Promotional credits amount.
in cents, min=0
currency_code
The currency code (ISO 4217 format) for promotional credit.
string, max chars=3
description
Detailed description of this promotional credits.
string, max chars=250
credit_type
Type of promotional credits provided to customer.
enumerated string, default=general
Possible values are
loyalty_creditsLoyalty Credits.referral_rewardsReferral.generalGeneral.
reference
Describes why promotional credits were provided.
optional, string, max chars=500
closing_balance
Closing balance as on end date.
in cents, min=0
done_by
The user who added/deducted the credit. If created via API, this contains the name given for the API key used.
optional, string, max chars=100
created_at
Timestamp indicating when this promotional credit resource is created.
timestamp(UTC) in seconds

This API call can be used to add promotional credits to a customer. Learn more about Promotional Credits.

For example, if a customer has credits of $10, if you pass the amount as $10, then the customer’s credit balance would become $20.

Sample Request
curl  https://{site}.chargebee.com/api/v2/promotional_credits/add \
     -u {site_api_key}: \
     -d customer_id="4gkYnd21ouvW" \
     -d amount="100" \
     -d description="add promotional credits"
copy
curl  https://{site}.chargebee.com/api/v2/promotional_credits/add \
     -u {site_api_key}: \
     -d customer_id="4gkYnd21ouvW" \
     -d amount="100" \
     -d description="add promotional credits"

Sample Response [ JSON ]

{"promotional_credit": { "id": "pc_3Nl8LlrQWK3CwS3Z", "customer_id": "4gkYnd21ouvW", "type": "increment", "amount": 100, "description": "add promotional credits", "credit_type": "general", "closing_balance": 100, "created_at": 1506418667, "object": "promotional_credit", "currency_code": "USD" }}

URL Format POST

https://{site}.chargebee.com/api/v2/promotional_credits/add
customer_id
Identifier of the customer.
required, string, max chars=50
amount
Promotional credits amount.
required, in cents, min=0
currency_code
The currency code (ISO 4217 format) for promotional credit.
required if Multicurrency is enabled, string, max chars=3
description
Detailed description of this promotional credits.
required, string, max chars=250
credit_type
Type of promotional credits provided to customer.
optional, enumerated string, default=general
Possible values are
loyalty_creditsLoyalty Credits.referral_rewardsReferral.generalGeneral.
reference
Describes why promotional credits were provided.
optional, string, max chars=500
Resource object representing promotional_credit.
always returned

This API call can be used to deduct promotional credits for a customer. Learn more about Promotional Credits.

For example, if a customer has a credit balance of $20, if you pass the amount as $5, then the customer’s credit balance would become $15.

Sample Request
curl  https://{site}.chargebee.com/api/v2/promotional_credits/deduct \
     -u {site_api_key}: \
     -d customer_id="4gkYnd21ouvW" \
     -d amount="100" \
     -d description="deduct promotional credits"
copy
curl  https://{site}.chargebee.com/api/v2/promotional_credits/deduct \
     -u {site_api_key}: \
     -d customer_id="4gkYnd21ouvW" \
     -d amount="100" \
     -d description="deduct promotional credits"

Sample Response [ JSON ]

{"promotional_credit": { "id": "pc_3Nl8LlrQWK3Cy33b", "customer_id": "4gkYnd21ouvW", "type": "decrement", "amount": 100, "description": "deduct promotional credits", "credit_type": "general", "closing_balance": 0, "created_at": 1506418667, "object": "promotional_credit", "currency_code": "USD" }}

URL Format POST

https://{site}.chargebee.com/api/v2/promotional_credits/deduct
customer_id
Identifier of the customer.
required, string, max chars=50
amount
Promotional credits amount.
required, in cents, min=0
currency_code
The currency code (ISO 4217 format) for promotional credit.
required if Multicurrency is enabled, string, max chars=3
description
Detailed description of this promotional credits.
required, string, max chars=250
credit_type
Type of promotional credits provided to customer.
optional, enumerated string, default=general
Possible values are
loyalty_creditsLoyalty Credits.referral_rewardsReferral.generalGeneral.
reference
Describes why promotional credits were provided.
optional, string, max chars=500
Resource object representing promotional_credit.
always returned

This API call can be used to set the promotional credits balnce of a customer. Learn more about Promotional Credits.

For example, if a customer has a credit balance of $10 and if you would like to set the balance to $100, you could pass the amount as $100.

Sample Request
curl  https://{site}.chargebee.com/api/v2/promotional_credits/set \
     -u {site_api_key}: \
     -d customer_id="4gkYnd21ouvW" \
     -d amount="100" \
     -d description="set promotional credits"
copy
curl  https://{site}.chargebee.com/api/v2/promotional_credits/set \
     -u {site_api_key}: \
     -d customer_id="4gkYnd21ouvW" \
     -d amount="100" \
     -d description="set promotional credits"

Sample Response [ JSON ]

{"promotional_credit": { "id": "pc_3Nl8LlrQWK3CzN3d", "customer_id": "4gkYnd21ouvW", "type": "increment", "amount": 100, "description": "set promotional credits", "credit_type": "general", "closing_balance": 100, "created_at": 1506418667, "object": "promotional_credit", "currency_code": "USD" }}

URL Format POST

https://{site}.chargebee.com/api/v2/promotional_credits/set
customer_id
Identifier of the customer.
required, string, max chars=50
amount
Promotional credits amount.
required, in cents, min=0
currency_code
The currency code (ISO 4217 format) for promotional credit.
required if Multicurrency is enabled, string, max chars=3
description
Detailed description of this promotional credits.
required, string, max chars=250
credit_type
Type of promotional credits provided to customer.
optional, enumerated string, default=general
Possible values are
loyalty_creditsLoyalty Credits.referral_rewardsReferral.generalGeneral.
reference
Describes why promotional credits were provided.
optional, string, max chars=500
Resource object representing promotional_credit.
always returned
List Promotional Credit.
Sample Request
curl  https://{site}.chargebee.com/api/v2/promotional_credits \
     -G  \
     -u {site_api_key}: \
     --data-urlencode limit="5"
copy
curl  https://{site}.chargebee.com/api/v2/promotional_credits \
     -G  \
     -u {site_api_key}: \
     --data-urlencode limit="5"

Sample Response [ JSON ]

{ "list": [ {"promotional_credit": { "id": "pc_3Nl8LlrQWK3CzN3d", "customer_id": "4gkYnd21ouvW", "type": "increment", "amount": 100, "description": "set promotional credits", "credit_type": "general", "closing_balance": 100, "created_at": 1506418667, "object": "promotional_credit", "currency_code": "USD" }}, {..} ], "next_offset": "[\"1506418667000\",\"129000000004\"]" }

URL Format GET

https://{site}.chargebee.com/api/v2/promotional_credits
limit
Limits the number of resources to be returned.
optional, integer, default=10, min=1, max=100
offset
Allows you to fetch the next set of resources. The value used for this parameter must be the value returned for next_offset parameter in the previous API call.
optional, string, max chars=1000
Filter Params
For operator usages, see the Pagination and Filtering section.
id[<operator>]
To filter based on PromotionalCredit Id.
Supported operators : is, is_not, starts_with

Example id[is] = "1bkfc8dw2o"
optional, string filter
created_at[<operator>]
To filter based on PromotionalCredit Created At.
Supported operators : after, before, on, between

Example created_at[on] = "1435054328"
optional, timestamp(UTC) in seconds filter
type[<operator>]
To filter based on PromotionalCredit Type. Possible values are : increment, decrement.
Supported operators : is, is_not, in, not_in

Example type[is_not] = "increment"
optional, enumerated string filter
customer_id[<operator>]
To filter based on PromotionalCredit Customer Id.
Supported operators : is, is_not, starts_with

Example customer_id[is_not] = "4gkYnd21ouvW"
optional, string filter
Resource object representing promotional_credit.
always returned
next_offset
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”.
optional, string, max chars=1000
Retrieves the promotional credits.
Sample Request
curl  https://{site}.chargebee.com/api/v2/promotional_credits/3Nl8LcOQWK2jMp74 \
     -u {site_api_key}:
copy
curl  https://{site}.chargebee.com/api/v2/promotional_credits/3Nl8LcOQWK2jMp74 \
     -u {site_api_key}:

Sample Response [ JSON ]

{"promotional_credit": { "id": "3Nl8LcOQWK2jMp74", "customer_id": "4gkYnd21ouvW", "type": "increment", "amount": 1000, "description": "Promotional credits added", "credit_type": "general", "closing_balance": 1000, "done_by": "rr@mannar.com", "created_at": 1506418553, "object": "promotional_credit", "currency_code": "USD" }}

URL Format GET

https://{site}.chargebee.com/api/v2/promotional_credits/{account_credit_id}
Resource object representing promotional_credit.
always returned