Note: This doc is for the latest version of Chargebee Orders. If you enabled Chargebee Orders before September-30-2018, you may be using the legacy version of the feature and its API. For help in migrating to the current system or using the legacy API for Chargebee Orders, please contact support

Orders are automatically generated for an invoice when it gets paid, based on the shipping preference chosen for the invoice's product and the shipping date configuration. They can be updated either via api or merchant web console (a.k.a admin console).

Sample order [ JSON ]

{ "created_at": 1517680317, "created_by": "full_access_key_v1", "deleted": false, "id": "__test__5SK0bLNFRFuFTuloy", "invoice_id": "__demo_inv__2", "object": "order", "order_type": "manual", "price_type": "tax_exclusive", "status": "new", "status_update_at": 1517680317 }

Model Class

ChargeBee_Order
id
Uniquely identifies the order. It is the api identifier for the order.
string, max chars=40
documentNumber
The order's serial number.
optional, string, max chars=50
invoiceId
The invoice number which acts as an identifier for invoice and is generated sequentially.
optional, string, max chars=50
subscriptionId
The subscription for which the order is created.
optional, string, max chars=50
customerId
The customer for which the order is created.
optional, string, max chars=50
status
The status of this order.
optional, enumerated string, default=new
Possible values are
newOrder has been created. Applicable only if you are using Chargebee's legacy order management system.processingOrder is being processed. Applicable only if you are using Chargebee's legacy order management system.completeOrder has been processed successfully. Applicable only if you are using Chargebee's legacy order management system.cancelledOrder has been cancelled. Applicable only if you are using Chargebee's legacy order management system.
voidedOrder has been voided. Applicable only if you are using Chargebee's legacy order management system.queuedOrder is yet to be processed by any system, these are scheduled orders created by Chargebee.awaiting_shipmentThe order has been picked up by an integration system, and synced to a shipping management platform.on_holdThe order is paused from being processed.deliveredThe order has been delivered to the customer.shippedThe order has moved from order management system to a shipping system.partially_deliveredThe order has been partially delivered to the customer.returnedThe order has been returned after delivery.
Show all values[+]
cancellationReason
Cancellation reason.
optional, enumerated string
Possible values are
shipping_cut_off_passedThe invoice has been paid late and Chargebee cancel's the first order for the invoice.product_unsatisfactoryProduct unsatisfactory.third_party_cancellationThird party cancellation.product_not_requiredProduct not required.
delivery_date_missedDelivery date missed.alternative_foundAlternative found.invoice_written_offThe invoice has been completely written off. Orders are generated by Chargebee in cancelled state.invoice_voidedThe invoice for which the order was createed has been voided.fraudulent_transactionFraudulent transaction.payment_declinedPayment declined.subscription_cancelledThe subsctiption for which the order was created has been cancelled.product_not_availableProduct not available.othersOther reason.
Show all values[+]
paymentStatus
The payment status of the order.
optional, enumerated string
Possible values are
not_paidNOT_PAID.paidPAID.
orderType
Order type.
optional, enumerated string
Possible values are
manualThe order has been created by the the user using Chargebee's legacy order management system.system_generatedThe order has been created by Chargebee automatically based on the preferences set by the user.
priceType
The price type of the order.
enumerated string, default=tax_exclusive
Possible values are
tax_exclusiveAll amounts in the document are exclusive of tax.tax_inclusiveAll amounts in the document are inclusive of tax.
referenceId
Reference id can be used to map the orders in the shipping/order management application to the orders in ChargeBee. The reference_id generally is same as the order id in the third party application.
optional, string, max chars=50
fulfillmentStatus
The fulfillment status of an order as reflected in the shipping/order management application. Typical statuses include Shipped,Awaiting Shipment,Not fulfilled etc;.
optional, string, max chars=50
orderDate
The date on which the order will start getting processed.
optional, timestamp(UTC) in seconds
shippingDate
This is the date on which the order will be delivered to the customer.
optional, timestamp(UTC) in seconds
note
The custom note for the order.
optional, string, max chars=600
trackingId
The tracking id of the order.
optional, string, max chars=50
batchId
Unique id to identify a group of orders.
optional, string, max chars=50
createdBy
The source (or the user) from where the order has been created.
optional, string, max chars=50
shipmentCarrier
Shipment carrier.
optional, string, max chars=50
invoiceRoundOffAmount
The total round off taken from the invoice level.
optional, in cents, min=0
tax
The total tax for the order.
optional, in cents, min=0
amountPaid
Total amount paid for the order.
optional, in cents, min=0
amountAdjusted
Total amount adjusted for the order.
optional, in cents, min=0
refundableCreditsIssued
The total amount issued as credits on behalf of this order.
optional, in cents, min=0
refundableCredits
The total amount that can be issued as credits for this order.
optional, in cents, min=0
roundingAdjustement
Rounding adjustment.
optional, in cents
paidOn
The timestamp indicating the date & time the order's invoice got paid.
optional, timestamp(UTC) in seconds
shippingCutOffDate
The time after which an order becomes unservicable.
optional, timestamp(UTC) in seconds
createdAt
The time at which the order was created.
timestamp(UTC) in seconds
statusUpdateAt
The time at which the order status was last updated.
optional, timestamp(UTC) in seconds
deliveredAt
The time at which the order was delivered.
optional, timestamp(UTC) in seconds
shippedAt
The time at which the order was shipped.
optional, timestamp(UTC) in seconds
resourceVersion
Version number of this resource. Each update of this resource results in incremental change of this number. This attribute will be present only if the resource has been updated after 2016-09-28.
optional, long
updatedAt
The order's last modified time.
optional, timestamp(UTC) in seconds
cancelledAt
The time at which the order was cancelled.
optional, timestamp(UTC) in seconds
discount
Total discount given for the order.
optional, in cents, min=0
subTotal
The order's sub-total.
optional, in cents, min=0
total
Total amount charged for the order.
optional, in cents, min=0
deleted
Indicates that this resource has been deleted.
boolean
currencyCode
The currency code (ISO 4217 format) for the invoice.
optional, string, max chars=3
isGifted
Boolean indicating whether this order is gifted or not.
optional, boolean, default=false
giftNote
The gift message added by the gifter during purchase.
optional, string, max chars=500
giftId
The gift_id if the order is a gift order.
optional, string, max chars=50
orderLineItems
Show attributes[+]
The list of line items for this order.
optional, list of order_line_item
Order line item attributes
id
The identifier for the order line item.
string, max chars=40
invoiceId
The invoice of the line item.
string, max chars=50
invoiceLineItemId
The invoice line item id associated with this order line item.
string, max chars=40
unitPrice
The unit price.
optional, in cents, min=0
description
The line item description.
optional, string, max chars=250
amount
The sub total, of the order line item.
optional, in cents, min=0
fulfillmentQuantity
The quantity that is going to get fulfilled for this order.
optional, integer, min=0
fulfillmentAmount
The amount that is going to get fulfilled for this order(amount after tax and discount).
optional, in cents, min=0
taxAmount
The total tax applied on this line item.
optional, in cents, min=0
amountPaid
The total amount paid on the invoice, on behalf of this delivery.
optional, in cents, min=0
amountAdjusted
The total amount adjusted on the invoice, on behalf of this delivery.
optional, in cents, min=0
refundableCreditsIssued
The total refundable credits issued on the invoice, on behalf of this delivery.
optional, in cents, min=0
refundableCredits
The total amount issued as credits on behalf of this delivery.
optional, in cents, min=0
isShippable
Appliable only if configured to include non shippable charges in orders, specifies if the charge is applicable for shipping.
boolean
sku
The SKU for the delivery.
optional, string, max chars=250
status
The status of this order.
optional, enumerated string, default=queued
Possible values are
queuedNot processed for shipping yet.awaiting_shipmentMoved to shipping platform.on_holdThe delivery has been moved to "On hold" status.deliveredThe order line item has been delivered.shippedThe order line item has been shipped.partially_deliveredThe order has been partially delivered to the customer.returnedThe order has been returned after delivery.cancelledThe order has been returned after delivery.
entityType
Specifies the modelled entity (plan / addon etc) this lineitem is based on.
enumerated string
Possible values are
plan_setupIndicates that this lineitem is based on 'Plan Setup' charge. The 'entity_id' attribute specifies the plan id.planIndicates that this lineitem is based on 'Plan' entity. The 'entity_id' attribute specifies the plan id.addonIndicates that this lineitem is based on 'Addon' entity. The 'entity_id' attribute specifies the addon id.adhocIndicates that this lineitem is not modelled. i.e created adhoc. So the 'entity_id' attribute will be null in this case.
itemLevelDiscountAmount
Item level discount amount.
optional, in cents, min=0
discountAmount
The discount given on the order line item.
optional, in cents, min=0
entityId
The identifier of the modelled entity this lineitem is based on. Will be null for 'adhoc' entity type.
optional, string, max chars=50
shippingAddress
Show attributes[+]
Shipping address for the order.
optional, shipping_address
Shipping addres attributes
firstName
First name.
optional, string, max chars=150
lastName
Last name.
optional, string, max chars=150
email
Email.
optional, string, max chars=70
company
Company name.
optional, string, max chars=250
phone
Phone number.
optional, string, max chars=50
line1
Address line 1.
optional, string, max chars=180
line2
Address line 2.
optional, string, max chars=150
line3
Address line 3.
optional, string, max chars=150
city
City.
optional, string, max chars=50
stateCode
The ISO 3166-2 state/province code without the country prefix. Currently supported for USA, Canada and India. For instance, for Arizona (USA), set the state_code as AZ (not US-AZ). or, for Tamil Nadu (India), set the state_code as TN (not IN-TN). or, for British Columbia (Canada), set the state_code as BC (not CA-BC).
Note: If the 'state_code' is specified, the 'state' attribute should not be provided as Chargebee will set the value automatically (for US, Canada, India).
optional, string, max chars=50
state
The state/province name.
optional, string, max chars=50
country
2-letter ISO 3166 alpha-2 country code.
optional, string, max chars=50
zip
Zip or Postal code.
optional, string, max chars=20
validationStatus
The address verification status.
optional, enumerated string, default=not_validated
Possible values are
not_validatedAddress is not yet validated.validAddress was validated successfully.partially_validAddress is verified but only partially.invalidAddress is invalid.
billingAddress
Show attributes[+]
Billing address for the order.
optional, billing_address
Billing addres attributes
firstName
First name.
optional, string, max chars=150
lastName
Last name.
optional, string, max chars=150
email
Email.
optional, string, max chars=70
company
Company name.
optional, string, max chars=250
phone
Phone number.
optional, string, max chars=50
line1
Address line 1.
optional, string, max chars=150
line2
Address line 2.
optional, string, max chars=150
line3
Address line 3.
optional, string, max chars=150
city
City.
optional, string, max chars=50
stateCode
The ISO 3166-2 state/province code without the country prefix. Currently supported for USA, Canada and India. For instance, for Arizona (USA), set the state_code as AZ (not US-AZ). or, for Tamil Nadu (India), set the state_code as TN (not IN-TN). or, for British Columbia (Canada), set the state_code as BC (not CA-BC).
Note: If the 'state_code' is specified, the 'state' attribute should not be provided as Chargebee will set the value automatically (for US, Canada, India).
optional, string, max chars=50
state
State or Province.
optional, string, max chars=50
country
2-letter ISO 3166 alpha-2 country code.
optional, string, max chars=50
zip
Zip or Postal code.
optional, string, max chars=20
validationStatus
The address verification status.
optional, enumerated string, default=not_validated
Possible values are
not_validatedAddress is not yet validated.validAddress was validated successfully.partially_validAddress is verified but only partially.invalidAddress is invalid.
lineItemTaxes
Show attributes[+]
The list of taxes applied on the order line items.
optional, list of line_item_tax
Line item tax attributes
lineItemId
The unique reference id of the line item for which the tax is applicable.
optional, string, max chars=40
taxName
The name of the tax applied.
string, max chars=100
taxRate
The rate of tax used to calculate tax amount.
double, default=0.0, min=0.0, max=100.0
isPartialTaxApplied
Indicates if tax is applied only on a portion of the line item amount.
optional, boolean
isNonComplianceTax
Indicates the non-compliance tax that should not be reported to the jurisdiction.
optional, boolean
taxableAmount
Indicates the actual portion of the line item amount that is taxable.
in cents, min=0
taxAmount
The tax amount.
in cents, min=0
taxJurisType
The type of tax jurisdiction.
optional, enumerated string
Possible values are
countryThe tax jurisdiction is a country.federalThe tax jurisdiction is a federal.stateThe tax jurisdiction is a state.countyThe tax jurisdiction is a county.cityThe tax jurisdiction is a city.specialSpecial tax jurisdiction.unincorporatedCombined tax of state and county.otherJurisdictions other than the ones listed above.
taxJurisName
The name of the tax jurisdiction.
optional, string, max chars=250
taxJurisCode
The tax jurisdiction code.
optional, string, max chars=250
taxAmountInLocalCurrency
Total tax amount in the currency of the place of supply. This is applicable only for Invoice and Credit Notes API.
optional, in cents, min=0
localCurrencyCode
The currency code (ISO 4217 format) of the place of supply in which VAT needs to be converted and displayed. This is applicable only for Invoice and Credit Notes API.
optional, string, max chars=null
lineItemDiscounts
Show attributes[+]
The list of discounts applied for the order.
optional, list of line_item_discount
Line item discount attributes
lineItemId
The unique reference id of the line item for which the discount is applicable.
string, max chars=50
discountType
Type of this discount line item.
enumerated string
Possible values are
item_level_couponRepresents the 'Item' level coupons applied to this invoice. Further the 'coupon_id' attribute specifies the coupon id this discount is based on.document_level_couponRepresents the 'Document' level coupons applied to this document. Further the 'coupon_id' attribute specifies the coupon id this discount is based on.promotional_creditsRepresents the Promotional Credits item in invoice. The 'coupon_id' attribute will be null in this case.prorated_creditsRepresents the credit adjustment items in invoice. The 'coupon_id' attribute will be null in this case.
couponId
Coupon id.
optional, string, max chars=50
discountAmount
Discount amount.
in cents, min=0
linkedCreditNotes
Show attributes[+]
The credit notes linked to the order.
optional, list of order_line_item_linked_credit
Linked credit note attributes
amount
The amount issued for this order.
optional, in cents, min=0
type
The credit note type.
enumerated string
Possible values are
adjustmentAdjustment Credit Note.refundableRefundable Credit Note.
id
Credit-note id.
string, max chars=50
status
The credit note status.
enumerated string
Possible values are
adjustedWhen the Credit Note has been adjusted against an invoice.refundedWhen the entire credits (Credit Note amount) have been used (i.e either allocated to invoices or refunded).refund_dueWhen the credits are yet to be used, or have been partially used.voidedWhen the Credit Note has been cancelled.
amountAdjusted
Total amount adjusted on the order for the linked credit note. Applicable if the linked credit note is of the type 'adjustement'.
optional, in cents, min=0
amountRefunded
Total refundable credits issued on the order for the linked credit note. Applicable if the linked credit note is of the type 'refundable'.
optional, in cents, min=0
Creates an order for an invoice. If 'status' is not passed while creating an order, the default status('new') is set. This api endpoint is only applicable if you are using Chargebee's legacy order management system.
Sample Codes

require 'ChargeBee.php';
ChargeBee_Environment::configure("{site}","{site_api_key}");
$result = ChargeBee_Order::create(array(
  "invoiceId" => "__demo_inv__2"
  ));
$order = $result->order();
copy

require 'ChargeBee.php';
ChargeBee_Environment::configure("{site}","{site_api_key}");
$result = ChargeBee_Order::create(array(
  "invoiceId" => "__demo_inv__2"
  ));
$order = $result->order();

Sample Result [ JSON ]

Show more...
{"order": { "created_at": 1517680317, "created_by": "full_access_key_v1", "deleted": false, "id": "__test__5SK0bLNFRFuFTuloy", "invoice_id": "__demo_inv__2", "object": "order", "order_type": "manual", "price_type": "tax_exclusive", "status": "new", "status_update_at": 1517680317 }}

Method

ChargeBee_Order::create(array(<param name> => <value>,<param name> => <value> ...))
id
Uniquely identifies the order. If not given, this will be auto-generated.
optional, string, max chars=40
invoiceId
The invoice number which acts as an identifier for invoice and is generated sequentially.
required, string, max chars=50
status
The order status.
optional, enumerated string
Possible values are
newOrder has been created. Applicable only if you are using Chargebee's legacy order management system.processingOrder is being processed. Applicable only if you are using Chargebee's legacy order management system.completeOrder has been processed successfully. Applicable only if you are using Chargebee's legacy order management system.cancelledOrder has been cancelled. Applicable only if you are using Chargebee's legacy order management system.voidedOrder has been voided. Applicable only if you are using Chargebee's legacy order management system.
referenceId
Reference id can be used to map the orders in the shipping/order management application to the orders in ChargeBee. The reference_id generally is same as the order id in the third party application.
optional, string, max chars=50
fulfillmentStatus
The fulfillment status of an order as reflected in the shipping/order management application. Typical statuses include Shipped,Awaiting Shipment,Not fulfilled etc;.
optional, string, max chars=50
note
The custom note for the order.
optional, string, max chars=600
trackingId
The tracking id of the order.
optional, string, max chars=50
batchId
Unique id to identify a group of orders.
optional, string, max chars=50
Resource object representing order.
always returned
Updates an order. If the status of an order is changed while updating the order, the status_update_at attribute is set with the current time.
Sample Codes

require 'ChargeBee.php';
ChargeBee_Environment::configure("{site}","{site_api_key}");
$result = ChargeBee_Order::update("1",array(
  "status" => "delivered",
  "shippedAt" => 1517075521,
  "deliveredAt" => 1517680321
  ));
$order = $result->order();
copy

Sample Result [ JSON ]

Method

ChargeBee_Order::update(<order_id>,array(<param name> => <value>,<param name> => <value> ...))
referenceId
Reference id is the unique identifier of the order in the shipping/order management application.
optional, string, max chars=50
batchId
Unique id to identify a group of orders.
optional, string, max chars=50
note
The custom note for the order.
optional, string, max chars=600
shippingDate
The date on which the order should be shipped to the customer.
optional, timestamp(UTC) in seconds
orderDate
The order date.
optional, timestamp(UTC) in seconds
cancelledAt
The time at which the order was cancelled.
optional, timestamp(UTC) in seconds
cancellationReason
Cancellation reason.
optional, enumerated string
Possible values are
shipping_cut_off_passedThe invoice has been paid late and Chargebee cancel's the first order for the invoice.product_unsatisfactoryProduct unsatisfactory.third_party_cancellationThird party cancellation.product_not_requiredProduct not required.
delivery_date_missedDelivery date missed.alternative_foundAlternative found.invoice_written_offThe invoice has been completely written off. Orders are generated by Chargebee in cancelled state.invoice_voidedThe invoice for which the order was createed has been voided.fraudulent_transactionFraudulent transaction.payment_declinedPayment declined.subscription_cancelledThe subsctiption for which the order was created has been cancelled.product_not_availableProduct not available.othersOther reason.
Show all values[+]
shippedAt
The time at which the order was shipped.
optional, timestamp(UTC) in seconds
deliveredAt
The time at which the order was delivered.
optional, timestamp(UTC) in seconds
trackingId
The tracking id of the order.
optional, string, max chars=50
shipmentCarrier
The carrier used to ship the goods to the customer. Ex:- FedEx.
optional, string, max chars=50
fulfillmentStatus
The fulfillment status of an order as reflected in the shipping/order management application. Typical statuses include Shipped,Awaiting Shipment,Not fulfilled etc;.
optional, string, max chars=50
status
The order status.
optional, enumerated string
Possible values are
newOrder has been created. Applicable only if you are using Chargebee's legacy order management system.processingOrder is being processed. Applicable only if you are using Chargebee's legacy order management system.completeOrder has been processed successfully. Applicable only if you are using Chargebee's legacy order management system.cancelledOrder has been cancelled. Applicable only if you are using Chargebee's legacy order management system.
voidedOrder has been voided. Applicable only if you are using Chargebee's legacy order management system.queuedOrder is yet to be processed by any system, these are scheduled orders created by Chargebee.awaiting_shipmentThe order has been picked up by an integration system, and synced to a shipping management platform.on_holdThe order is paused from being processed.deliveredThe order has been delivered to the customer.shippedThe order has moved from order management system to a shipping system.partially_deliveredThe order has been partially delivered to the customer.returnedThe order has been returned after delivery.
Show all values[+]
+
shippingAddress
Associative array of parameters for shippingAddress
pass parameters as shippingAddress => array("<param name>" => "<value>",...)
firstName
First name.
optional, string, max chars=150
lastName
Last name.
optional, string, max chars=150
email
Email.
optional, string, max chars=70
company
Company name.
optional, string, max chars=250
phone
Phone number.
optional, string, max chars=50
line1
Address line 1.
optional, string, max chars=180
line2
Address line 2.
optional, string, max chars=150
line3
Address line 3.
optional, string, max chars=150
city
City.
optional, string, max chars=50
stateCode
The ISO 3166-2 state/province code without the country prefix. Currently supported for USA, Canada and India. For instance, for Arizona (USA), set the state_code as AZ (not US-AZ). or, for Tamil Nadu (India), set the state_code as TN (not IN-TN). or, for British Columbia (Canada), set the state_code as BC (not CA-BC).
Note: If the 'state_code' is specified, the 'state' attribute should not be provided as Chargebee will set the value automatically (for US, Canada, India).
optional, string, max chars=50
state
The state/province name. Use this to pass the state/province information for cases where 'state_code' is not supported or cannot be passed.
optional, string, max chars=50
zip
Zip or Postal code.
optional, string, max chars=20
country
2-letter ISO 3166 alpha-2 country code.
optional, string, max chars=50
validationStatus
The address verification status.
optional, enumerated string
Possible values are
not_validatedAddress is not yet validated.validAddress was validated successfully.partially_validAddress is verified but only partially.invalidAddress is invalid.
+
orderLineItems
Array containing associative arrays of parameters for orderLineItems
pass parameters as orderLineItems => array(array("<param name>" => "<value>",...), array(..)...)
id
The identifier for the order line item.
optional, string, max chars=40
status
The order line item's delivery status.
optional, enumerated string
Possible values are
queuedNot processed for shipping yet.awaiting_shipmentMoved to shipping platform.on_holdThe delivery has been moved to "On hold" status.deliveredThe order line item has been delivered.shippedThe order line item has been shipped.partially_deliveredThe order has been partially delivered to the customer.returnedThe order has been returned after delivery.cancelledThe order has been returned after delivery.
sku
The SKU code for the order line item product.
optional, string, max chars=250
Resource object representing order.
always returned
Assigns order number to the order based on the settings, if not already assigned.
Sample Codes

require 'ChargeBee.php';
ChargeBee_Environment::configure("{site}","{site_api_key}");
$result = ChargeBee_Order::assignOrderNumber("1");
$order = $result->order();
copy

require 'ChargeBee.php';
ChargeBee_Environment::configure("{site}","{site_api_key}");
$result = ChargeBee_Order::assignOrderNumber("1");
$order = $result->order();

Sample Result [ JSON ]

Show more...
{"order": { "amount_adjusted": 0, "amount_paid": 40000, "base_currency_code": "USD", "created_at": 1517507518, "created_by": "Auto generated by system", "currency_code": "USD", "customer_id": "__test__5SK0bLNFRFuFTQxoD", "deleted": false, "discount": 0, "document_number": "1", "exchange_rate": 1, "id": "1", "invoice_id": "__demo_inv__1", "is_gifted": false, "linked_credit_notes": [], "object": "order", "order_date": 1517507517, "order_line_items": [ { "amount": 40000, "amount_adjusted": 0, "amount_paid": 40000, "description": "MB1S1P", "discount_amount": 0, "entity_id": "MB1S1P", "entity_type": "plan", "fulfillment_amount": 40000, "fulfillment_quantity": 1, "id": "o_li__test__KyVnTyRFuFTXVB0", "invoice_id": "__demo_inv__1", "invoice_line_item_id": "li___test__5SK0bLNFRFuFTRHoF", "is_shippable": true, "item_level_discount_amount": 0, "object": "order_line_item", "refundable_credits": 40000, "refundable_credits_issued": 0, "status": "queued", "tax_amount": 0, "unit_price": 40000 }, {..} ], "order_type": "system_generated", "paid_on": 1517507517, "payment_status": "paid", "price_type": "tax_exclusive", "refundable_credits": 40000, "refundable_credits_issued": 0, "resource_version": 1517507518000, "rounding_adjustement": 0, "shipping_date": 1517507517, "status": "queued", "sub_total": 40000, "subscription_id": "__test__5SK0bLNFRFuFTQxoD", "tax": 0, "total": 40000, "updated_at": 1517507518 }}

Method

ChargeBee_Order::assignOrderNumber(<order_id>)
Resource object representing order.
always returned
Cancel order and create a refundable credit note for the order.
Sample Codes

require 'ChargeBee.php';
ChargeBee_Environment::configure("{site}","{site_api_key}");
$result = ChargeBee_Order::cancel("1",array(
  "cancellationReason" => "product_unsatisfactory",
  "customerNotes" => "Products were defective"
  ));
$order = $result->order();
copy

require 'ChargeBee.php';
ChargeBee_Environment::configure("{site}","{site_api_key}");
$result = ChargeBee_Order::cancel("1",array(
  "cancellationReason" => "product_unsatisfactory",
  "customerNotes" => "Products were defective"
  ));
$order = $result->order();

Sample Result [ JSON ]

Show more...
{"order": { "amount_adjusted": 0, "amount_paid": 40000, "base_currency_code": "USD", "cancellation_reason": "product_unsatisfactory", "cancelled_at": 1517680317, "created_at": 1517507518, "created_by": "Auto generated by system", "currency_code": "USD", "customer_id": "__test__5SK0bLNFRFuFTb7oO", "deleted": false, "discount": 0, "document_number": "1", "exchange_rate": 1, "id": "1", "invoice_id": "__demo_inv__1", "is_gifted": false, "linked_credit_notes": [], "object": "order", "order_date": 1517507517, "order_line_items": [ { "amount": 40000, "amount_adjusted": 0, "amount_paid": 40000, "description": "MB1S1P", "discount_amount": 0, "entity_id": "MB1S1P", "entity_type": "plan", "fulfillment_amount": 40000, "fulfillment_quantity": 1, "id": "o_li__test__KyVnTyRFuFTgfB9", "invoice_id": "__demo_inv__1", "invoice_line_item_id": "li___test__5SK0bLNFRFuFTbPoQ", "is_shippable": true, "item_level_discount_amount": 0, "object": "order_line_item", "refundable_credits": 40000, "refundable_credits_issued": 0, "status": "queued", "tax_amount": 0, "unit_price": 40000 }, {..} ], "order_type": "system_generated", "paid_on": 1517507517, "payment_status": "paid", "price_type": "tax_exclusive", "refundable_credits": 40000, "refundable_credits_issued": 0, "resource_version": 1517680317000, "rounding_adjustement": 0, "shipping_date": 1517507517, "status": "cancelled", "status_update_at": 1517680317, "sub_total": 40000, "subscription_id": "__test__5SK0bLNFRFuFTb7oO", "tax": 0, "total": 40000, "updated_at": 1517680317 }}

Method

ChargeBee_Order::cancel(<order_id>,array(<param name> => <value>,<param name> => <value> ...))
cancellationReason
Cancellation reason.
required, enumerated string
Possible values are
shipping_cut_off_passedThe invoice has been paid late and Chargebee cancel's the first order for the invoice.product_unsatisfactoryProduct unsatisfactory.third_party_cancellationThird party cancellation.product_not_requiredProduct not required.
delivery_date_missedDelivery date missed.alternative_foundAlternative found.invoice_written_offThe invoice has been completely written off. Orders are generated by Chargebee in cancelled state.invoice_voidedThe invoice for which the order was createed has been voided.fraudulent_transactionFraudulent transaction.payment_declinedPayment declined.subscription_cancelledThe subsctiption for which the order was created has been cancelled.product_not_availableProduct not available.othersOther reason.
Show all values[+]
customerNotes
The Customer Notes to be filled in the Credit Notes created to capture this refund detail.
optional, string, max chars=1000
cancelledAt
The time at which the order was cancelled.
optional, timestamp(UTC) in seconds
+
creditNote
Associative array of parameters for creditNote
pass parameters as creditNote => array("<param name>" => "<value>",...)
total
Credit Note amount in cents.
optional, in cents, default=0, min=0
Resource object representing order.
always returned
Create a refundable credit note for the order.
Sample Codes

require 'ChargeBee.php';
ChargeBee_Environment::configure("{site}","{site_api_key}");
$result = ChargeBee_Order::createRefundableCreditNote("1",array(
  "creditNote" => array(
    "reasonCode" => "product_unsatisfactory",
    "total" => 100
    )
  ));
$order = $result->order();
copy

require 'ChargeBee.php';
ChargeBee_Environment::configure("{site}","{site_api_key}");
$result = ChargeBee_Order::createRefundableCreditNote("1",array(
  "creditNote" => array(
    "reasonCode" => "product_unsatisfactory",
    "total" => 100
    )
  ));
$order = $result->order();

Sample Result [ JSON ]

Show more...
{"order": { "amount_adjusted": 0, "amount_paid": 40000, "base_currency_code": "USD", "created_at": 1517507521, "created_by": "Auto generated by system", "currency_code": "USD", "customer_id": "__test__5SK0bLNFRFuFUFSpY", "deleted": false, "discount": 0, "document_number": "1", "exchange_rate": 1, "id": "1", "invoice_id": "__demo_inv__1", "is_gifted": false, "linked_credit_notes": [ { "amount": 100, "id": "__demo_cn__1", "object": "order_line_item_linked_credit", "status": "refund_due", "type": "refundable" }, {..} ], "object": "order", "order_date": 1517507520, "order_line_items": [ { "amount": 40000, "amount_adjusted": 0, "amount_paid": 40000, "description": "MB1S1P", "discount_amount": 0, "entity_id": "MB1S1P", "entity_type": "plan", "fulfillment_amount": 40000, "fulfillment_quantity": 1, "id": "o_li__test__KyVnTyRFuFUKlBj", "invoice_id": "__demo_inv__1", "invoice_line_item_id": "li___test__5SK0bLNFRFuFUFqpa", "is_shippable": true, "item_level_discount_amount": 0, "object": "order_line_item", "refundable_credits": 39900, "refundable_credits_issued": 100, "status": "queued", "tax_amount": 0, "unit_price": 40000 }, {..} ], "order_type": "system_generated", "paid_on": 1517507520, "payment_status": "paid", "price_type": "tax_exclusive", "refundable_credits": 39900, "refundable_credits_issued": 100, "resource_version": 1517680319000, "rounding_adjustement": 0, "shipping_date": 1517507520, "status": "queued", "sub_total": 40000, "subscription_id": "__test__5SK0bLNFRFuFUFSpY", "tax": 0, "total": 40000, "updated_at": 1517680319 }}

Method

ChargeBee_Order::createRefundableCreditNote(<order_id>,array(<param name> => <value>,<param name> => <value> ...))
customerNotes
The Customer Notes to be filled in the Credit Notes created to capture this refund detail.
optional, string, max chars=1000
+
creditNote
Associative array of parameters for creditNote
pass parameters as creditNote => array("<param name>" => "<value>",...)
reasonCode
The reason for issuing this Credit Note. The following reason codes are supported now.
required, enumerated string, default=product_unsatisfactory
Possible values are
write_offThis reason will be set automatically for the Credit Notes created during invoice Write Off operation.subscription_changeThis reason will be set automatically for Credit Notes created during Change Subscription operation when proration is enabled.subscription_cancellationThis reason will be set automatically for Credit Notes created during cancel subscription operation.subscription_pauseThis reason will be automatically set to credit notes created during pause/resume subscription operation.
chargebackCan be set when you are recording your customer Chargebacks.product_unsatisfactoryProduct Unsatisfactory.service_unsatisfactoryService Unsatisfactory.order_changeOrder Change.order_cancellationOrder Cancellation.waiverWaiver.otherCan be set when none of the above reason codes are applicable.fraudulentFRAUDULENT.
Show all values[+]
total
Credit Note amount in cents.
required, in cents, default=0, min=0
Resource object representing order.
always returned
Reopen a cancelled order.
Sample Codes

require 'ChargeBee.php';
ChargeBee_Environment::configure("{site}","{site_api_key}");
$result = ChargeBee_Order::reopen("1");
$order = $result->order();
copy

require 'ChargeBee.php';
ChargeBee_Environment::configure("{site}","{site_api_key}");
$result = ChargeBee_Order::reopen("1");
$order = $result->order();

Sample Result [ JSON ]

Show more...
{"order": { "amount_adjusted": 0, "amount_paid": 40000, "base_currency_code": "USD", "cancelled_at": 1517680320, "created_at": 1517507521, "created_by": "Auto generated by system", "currency_code": "USD", "customer_id": "__test__5SK0bLNFRFuFUPcpq", "deleted": false, "discount": 0, "document_number": "1", "exchange_rate": 1, "id": "1", "invoice_id": "__demo_inv__1", "is_gifted": false, "linked_credit_notes": [], "object": "order", "order_date": 1517507520, "order_line_items": [ { "amount": 40000, "amount_adjusted": 0, "amount_paid": 40000, "description": "MB1S1P", "discount_amount": 0, "entity_id": "MB1S1P", "entity_type": "plan", "fulfillment_amount": 40000, "fulfillment_quantity": 1, "id": "o_li__test__KyVnTyRFuFUVBBs", "invoice_id": "__demo_inv__1", "invoice_line_item_id": "li___test__5SK0bLNFRFuFUQ2ps", "is_shippable": true, "item_level_discount_amount": 0, "object": "order_line_item", "refundable_credits": 40000, "refundable_credits_issued": 0, "status": "queued", "tax_amount": 0, "unit_price": 40000 }, {..} ], "order_type": "system_generated", "paid_on": 1517507520, "payment_status": "paid", "price_type": "tax_exclusive", "refundable_credits": 40000, "refundable_credits_issued": 0, "resource_version": 1517680320000, "rounding_adjustement": 0, "shipping_date": 1517507520, "status": "queued", "status_update_at": 1517680320, "sub_total": 40000, "subscription_id": "__test__5SK0bLNFRFuFUPcpq", "tax": 0, "total": 40000, "updated_at": 1517680320 }}

Method

ChargeBee_Order::reopen(<order_id>,array(<param name> => <value>,<param name> => <value> ...))
voidCancellationCreditNotes
Flag to void credit notes created for cancellation if they are unused.
optional, boolean
Resource object representing order.
always returned
Retrieves an order corresponding to the order id passed.
Sample Codes

require 'ChargeBee.php';
ChargeBee_Environment::configure("{site}","{site_api_key}");
$result = ChargeBee_Order::retrieve("1");
$order = $result->order();
copy

require 'ChargeBee.php';
ChargeBee_Environment::configure("{site}","{site_api_key}");
$result = ChargeBee_Order::retrieve("1");
$order = $result->order();

Sample Result [ JSON ]

Show more...
{"order": { "amount_adjusted": 0, "amount_paid": 40000, "base_currency_code": "USD", "created_at": 1517507522, "created_by": "Auto generated by system", "currency_code": "USD", "customer_id": "__test__5SK0bLNFRFuFUZ3q4", "deleted": false, "discount": 0, "document_number": "1", "exchange_rate": 1, "id": "1", "invoice_id": "__demo_inv__1", "is_gifted": false, "linked_credit_notes": [], "object": "order", "order_date": 1517507521, "order_line_items": [ { "amount": 40000, "amount_adjusted": 0, "amount_paid": 40000, "description": "MB1S1P", "discount_amount": 0, "entity_id": "MB1S1P", "entity_type": "plan", "fulfillment_amount": 40000, "fulfillment_quantity": 1, "id": "o_li__test__KyVnTyRFuFUeHC1", "invoice_id": "__demo_inv__1", "invoice_line_item_id": "li___test__5SK0bLNFRFuFUZQq6", "is_shippable": true, "item_level_discount_amount": 0, "object": "order_line_item", "refundable_credits": 40000, "refundable_credits_issued": 0, "status": "queued", "tax_amount": 0, "unit_price": 40000 }, {..} ], "order_type": "system_generated", "paid_on": 1517507521, "payment_status": "paid", "price_type": "tax_exclusive", "refundable_credits": 40000, "refundable_credits_issued": 0, "resource_version": 1517507522000, "rounding_adjustement": 0, "shipping_date": 1517507521, "status": "queued", "sub_total": 40000, "subscription_id": "__test__5SK0bLNFRFuFUZ3q4", "tax": 0, "total": 40000, "updated_at": 1517507522 }}

Method

ChargeBee_Order::retrieve(<order_id>)
Resource object representing order.
always returned
Lists the available orders.
Sample Codes

require 'ChargeBee.php';
ChargeBee_Environment::configure("{site}","{site_api_key}");
$all = ChargeBee_Order::all(array(
  "limit" => 3,
  "status[is]" => "queued"
  ));
foreach($all as $entry){
  $order = $entry->order();
}
copy

require 'ChargeBee.php';
ChargeBee_Environment::configure("{site}","{site_api_key}");
$all = ChargeBee_Order::all(array(
  "limit" => 3,
  "status[is]" => "queued"
  ));
foreach($all as $entry){
  $order = $entry->order();
}

Sample Result [ JSON ]

Show more...
{"list": [ {"order": { "amount_adjusted": 0, "amount_paid": 40000, "base_currency_code": "USD", "created_at": 1517507520, "created_by": "Auto generated by system", "currency_code": "USD", "customer_id": "__test__5SK0bLNFRFuFTvdoz", "deleted": false, "discount": 0, "document_number": "1", "exchange_rate": 1, "id": "1", "invoice_id": "__demo_inv__1", "is_gifted": false, "linked_credit_notes": [], "object": "order", "order_date": 1517507519, "order_line_items": [ { "amount": 40000, "amount_adjusted": 0, "amount_paid": 40000, "description": "MB1S1P", "discount_amount": 0, "entity_id": "MB1S1P", "entity_type": "plan", "fulfillment_amount": 40000, "fulfillment_quantity": 1, "id": "o_li__test__KyVnTyRFuFU1NBR", "invoice_id": "__demo_inv__1", "invoice_line_item_id": "li___test__5SK0bLNFRFuFTvyp1", "is_shippable": true, "item_level_discount_amount": 0, "object": "order_line_item", "refundable_credits": 40000, "refundable_credits_issued": 0, "status": "queued", "tax_amount": 0, "unit_price": 40000 }, {..} ], "order_type": "system_generated", "paid_on": 1517507519, "payment_status": "paid", "price_type": "tax_exclusive", "refundable_credits": 40000, "refundable_credits_issued": 0, "resource_version": 1517507520000, "rounding_adjustement": 0, "shipping_date": 1517507519, "status": "queued", "sub_total": 40000, "subscription_id": "__test__5SK0bLNFRFuFTvdoz", "tax": 0, "total": 40000, "updated_at": 1517507520 }}, {..} ]}

Method

ChargeBee_Order::all(array(<param name> => <value>,<param name> => <value> ...))
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
includeDeleted
If set to true, includes the deleted resources in the response. For the deleted resources in the response, the 'deleted' attribute will be 'true'.
optional, boolean, default=false
sortBy[<sort-order>]
Sorts based on the specified attribute.
Supported attributes : created_at, updated_at
Supported sort-orders : asc, desc

Example "sortBy[asc]" => "created_at"
This will sort the result based on the 'created_at' attribute in ascending(earliest first) order.
optional, string filter
Filter Params
For operator usages, see the Pagination and Filtering section.
id[<operator>]
To filter based on Order Id.
Supported operators : is, isNot, startsWith, in, notIn

Example "id[isNot]" => "890"
optional, string filter
invoiceId[<operator>]
To filter based on Order Invoice Id.
Supported operators : is, isNot, startsWith, in, notIn

Example "invoiceId[isNot]" => "INVOICE_982"
optional, string filter
subscriptionId[<operator>]
To filter based on Order Subscription Id.
Supported operators : is, isNot, startsWith

Example "subscriptionId[is]" => "null"
optional, string filter
status[<operator>]
To filter based on Order Status. Possible values are : new, processing, complete, cancelled, voided, queued, awaiting_shipment, on_hold, delivered, shipped, partially_delivered, returned.
Supported operators : is, isNot, in, notIn

Example "status[is]" => "queued"
optional, enumerated string filter
shippingDate[<operator>]
To filter based on Order Shipping Date.
Supported operators : after, before, on, between

Example "shippingDate[after]" => "1435054328"
optional, timestamp(UTC) in seconds filter
orderType[<operator>]
To filter based on Order Order Type. Possible values are : manual, system_generated.
Supported operators : is, isNot, in, notIn

Example "orderType[is]" => "system_generated"
optional, enumerated string filter
orderDate[<operator>]
To filter based on Order Order Date.
Supported operators : after, before, on, between

Example "orderDate[before]" => "1435054328"
optional, timestamp(UTC) in seconds filter
paidOn[<operator>]
To filter based on Order Paid On.
Supported operators : after, before, on, between

Example "paidOn[before]" => "1435054328"
optional, timestamp(UTC) in seconds filter
updatedAt[<operator>]
To filter based on Order Resource Updated At.
Supported operators : after, before, on, between

Example "updatedAt[on]" => "1243545465"
optional, timestamp(UTC) in seconds filter
createdAt[<operator>]
To filter based on Order Created At.
Supported operators : after, before, on, between

Example "createdAt[before]" => "1435054328"
optional, timestamp(UTC) in seconds filter
Resource object representing order.
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