You are viewing the documentation for the older version of our API (V1). Click here for information on upgrading to the latest version (V2).
This resource represents the transaction event that has happened in your account.

Sample transaction [ JSON ]

{ "id": "txn_3Nl8YKPQ8YayJEE", "customer_id": "8avVGOkx8U1MX", "subscription_id": "8avVGOkx8U1MX", "payment_method": "card", "gateway": "chargebee", "type": "payment", "date": 1414780231, "amount": 900, "id_at_gateway": "cb_3Nl8YKPQ8YayJbF", "status": "success", "object": "transaction", "masked_card_number": "************1111", "currency_code": "USD", "amount_unused": 0, "linked_invoices": [ { "invoice_id": "1", "applied_amount": 900, "applied_at": 1414780231, "invoice_date": 1414780230, "invoice_amount": 900 }, {..} ], "linked_refunds": [] }

API Index URL GET

https://{site}.chargebee.com/api/v1/transactions
id
Uniquely identifies the transaction.
string, max chars=40
customer_id
Identifier of the customer for which this transaction is made.
optional, string, max chars=50
subscription_id
Identifier of the subscription for which this transaction is made.
optional, string, max chars=50
payment_method
The Payment Method of this transaction.
enumerated string, default=card
Possible values are
cardCard.cashCash.checkCheck.chargebackChargeback.
bank_transferBank Transfer.amazon_paymentsAmazon Payments.paypal_express_checkoutPaypal Express Checkout.direct_debitDirect Debit.otherPayment Methods other than the above types.
Show all values[+]
reference_number
The reference number for this transaction. e.g check number in case of 'check' payments.
optional, string, max chars=100
gateway
Gateway through which this transaction was done. Applicable only for 'Card' Payment Method.
enumerated string
Possible values are
chargebeeChargebee test gateway.stripeStripe payment gateway.braintreeBraintree payment gateway.
authorize_netAuthorize.net payment gateway.paypal_proPaypal Pro Account.pinPin payment gateway.ewayeWAY Account.eway_rapideWAY Rapid gateway.worldpayWorldPay payment gateway.balanced_paymentsBalanced payment gateway.beanstreamBambora (formerly Beanstream).bluepayBluePay payment gateway.elavonElavon Virtual Merchant.first_data_globalFirst Data Global Gateway Virtual Terminal Account.hdfcHDFC Account.migsMasterCard Internet Gateway Service.nmiNMI gateway.ogoneIngenico ePayments (formerly Ogone).paymillPAYMILL payment gateway.paypal_payflow_proPayPal Payflow Pro gateway.sage_paySage Pay gateway.tco2Checkout payment gateway.wirecardWireCard Account.not_applicableIndicates that payment gateway is not applicable for this resource.
Show all values[+]
type
Type of the transaction.
enumerated string
Possible values are
authorizationIndicates the authorization transaction.paymentIndicates the payment transaction.refundIndicates a refund transaction.payment_reversalIndicates a reversal transaction.
date
Indicates when this transaction occurred.
optional, timestamp(UTC) in seconds
currency_code
The currency code (ISO 4217 format) for the transaction.
string, max chars=3
amount
Amount for this transaction.
optional, in cents, min=1
id_at_gateway
The id with which this transaction is referred in gateway.
optional, string, max chars=100
status
The status of this transaction.
optional, enumerated string
Possible values are
in_progressTransaction is being processed via ACH.successThe transaction is successful.voidedThe transaction got voided or authorization expired at gateway.failureTransaction failed. Refer the 'error_code' and 'error_text' fields to know the reason for failure.timeoutTransaction failed because of Gateway not accepting the connection.needs_attentionConnection with Gateway got terminated abruptly. So, status of this transaction needs to be resolved manually.
error_code
Error code received from the payment gateway on failure.
optional, string, max chars=100
error_text
Error message received from the payment gateway on failure.
optional, string, max chars=65k
voided_at
Timestamp indicating when the payment was voided or authorization expired at gateway.
optional, timestamp(UTC) in seconds
amount_unused
Unused amount present for this transaction. Applicable only for Payments.
optional, in cents, min=0
masked_card_number
The masked card number used for this transaction. Applicable only for 'Card' Payment Method.
optional, string, max chars=20
reference_transaction_id
Reference payment id. Applicable only for refund and reversal transactions.
optional, string, max chars=40
refunded_txn_id
Original transaction id that got refunded. Applicable only for refund transactions.
optional, string, max chars=40
reversal_transaction_id
Reversal transaction id. Applicable only for payment transactions.
optional, string, max chars=40
linked_invoices
Show attributes[+]
Applicable only for 'Payment' transactions. The list of invoices this 'payment' transaction is applied to.
optional, list of invoice_transaction
Linked invoice attributes
invoice_id
Identifier for the invoice.
string, max chars=50
applied_amount
The transaction amount applied to this invoice.
in cents, min=0
applied_at
Timestamp at which the transaction is applied.
timestamp(UTC) in seconds
invoice_date
The date this invoice is issued.
optional, timestamp(UTC) in seconds
invoice_amount
Total amount of the invoice.
optional, in cents, min=0
linked_refunds
Show attributes[+]
Applicable only for Payment transactions. The list of refunds issued for this Payment.
optional, list of txn_refunds_and_reversal
Linked refund attributes
txn_id
Uniquely identifies the transaction.
string, max chars=40
txn_status
The status of this transaction.
enumerated string
Possible values are
in_progressTransaction is being processed via ACH.successThe transaction is successful.voidedThe transaction got voided or authorization expired at gateway.failureTransaction failed. Refer the 'error_code' and 'error_text' fields to know the reason for failure.timeoutTransaction failed because of Gateway not accepting the connection.needs_attentionConnection with Gateway got terminated abruptly. So, status of this transaction needs to be resolved manually.
txn_date
Indicates when this refund occured.
timestamp(UTC) in seconds
txn_amount
Amount of this refund transaction.
in cents, min=1
Lists all the transactions.
Sample Request
curl  https://{site}.chargebee.com/api/v1/transactions \
     -G  \
     -u {site_api_key}: \
     --data-urlencode limit="5"
copy
curl  https://{site}.chargebee.com/api/v1/transactions \
     -G  \
     -u {site_api_key}: \
     --data-urlencode limit="5"

Sample Response [ JSON ]

{ "list": [ {"transaction": { "id": "txn_3Nl8YTUQ8YbCMi6H", "customer_id": "3Nl8YKPQ8YbADz5X", "subscription_id": "3Nl8YKPQ8YbADz5X", "payment_method": "card", "gateway": "stripe", "type": "payment", "date": 1484646449, "amount": 1000, "id_at_gateway": "ch_9wn9S8UHmsl6Qt", "status": "success", "object": "transaction", "masked_card_number": "************4242", "currency_code": "USD", "amount_unused": 0, "linked_invoices": [ { "invoice_id": "29", "applied_amount": 1000, "applied_at": 1484646451, "invoice_date": 1484646445, "invoice_amount": 1000 }, {..} ], "linked_refunds": [] }}, {..} ], "next_offset": "[\"1484646449000\",\"133000000127\"]" }

URL Format GET

https://{site}.chargebee.com/api/v1/transactions
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
Resource object representing transaction.
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 transactions for a customer sorted by the recent ones on top.
Sample Request
curl  https://{site}.chargebee.com/api/v1/customers/8avVGOkx8U1MX/transactions \
     -G  \
     -u {site_api_key}: \
     --data-urlencode limit="5"
copy
curl  https://{site}.chargebee.com/api/v1/customers/8avVGOkx8U1MX/transactions \
     -G  \
     -u {site_api_key}: \
     --data-urlencode limit="5"

Sample Response [ JSON ]

{ "list": [ {"transaction": { "id": "txn_3Nl8YKPQ8Yb0ho1n", "customer_id": "8avVGOkx8U1MX", "subscription_id": "8avVGOkx8U1MX", "payment_method": "card", "gateway": "chargebee", "type": "payment", "date": 1435689031, "amount": 900, "id_at_gateway": "cb_3Nl8YKPQ8Yb0hy1o", "status": "success", "object": "transaction", "masked_card_number": "************1111", "currency_code": "USD", "amount_unused": 0, "linked_invoices": [ { "invoice_id": "9", "applied_amount": 900, "applied_at": 1435689031, "invoice_date": 1435689030, "invoice_amount": 900 }, {..} ], "linked_refunds": [] }}, {..} ], "next_offset": "[\"1435689031000\",\"133000000124\"]" }

URL Format GET

https://{site}.chargebee.com/api/v1/customers/{customer_id}/transactions
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
Resource object representing transaction.
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 transactions for a subscription sorted by the recent ones on top.
Sample Request
curl  https://{site}.chargebee.com/api/v1/subscriptions/8avVGOkx8U1MX/transactions \
     -G  \
     -u {site_api_key}: \
     --data-urlencode limit="5"
copy
curl  https://{site}.chargebee.com/api/v1/subscriptions/8avVGOkx8U1MX/transactions \
     -G  \
     -u {site_api_key}: \
     --data-urlencode limit="5"

Sample Response [ JSON ]

{ "list": [ {"transaction": { "id": "txn_3Nl8YKPQ8Yb0ho1n", "customer_id": "8avVGOkx8U1MX", "subscription_id": "8avVGOkx8U1MX", "payment_method": "card", "gateway": "chargebee", "type": "payment", "date": 1435689031, "amount": 900, "id_at_gateway": "cb_3Nl8YKPQ8Yb0hy1o", "status": "success", "object": "transaction", "masked_card_number": "************1111", "currency_code": "USD", "amount_unused": 0, "linked_invoices": [ { "invoice_id": "9", "applied_amount": 900, "applied_at": 1435689031, "invoice_date": 1435689030, "invoice_amount": 900 }, {..} ], "linked_refunds": [] }}, {..} ], "next_offset": "[\"1435689031000\",\"133000000124\"]" }

URL Format GET

https://{site}.chargebee.com/api/v1/subscriptions/{subscription_id}/transactions
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
Resource object representing transaction.
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 transactions for an invoice with the recent ones on top. This returns all the payment attempts(manual & automatic) made for this invoice.
Sample Request
curl  https://{site}.chargebee.com/api/v1/invoices/1/transactions \
     -G  \
     -u {site_api_key}: \
     --data-urlencode limit="5"
copy
curl  https://{site}.chargebee.com/api/v1/invoices/1/transactions \
     -G  \
     -u {site_api_key}: \
     --data-urlencode limit="5"

Sample Response [ JSON ]

{"list": [ {"transaction": { "id": "txn_3Nl8YKPQ8YayJEE", "customer_id": "8avVGOkx8U1MX", "subscription_id": "8avVGOkx8U1MX", "payment_method": "card", "gateway": "chargebee", "type": "payment", "date": 1414780231, "amount": 900, "id_at_gateway": "cb_3Nl8YKPQ8YayJbF", "status": "success", "object": "transaction", "masked_card_number": "************1111", "currency_code": "USD", "amount_unused": 0, "linked_invoices": [ { "invoice_id": "1", "applied_amount": 900, "applied_at": 1414780231, "invoice_date": 1414780230, "invoice_amount": 900 }, {..} ], "linked_refunds": [] }}, {..} ]}

URL Format GET

https://{site}.chargebee.com/api/v1/invoices/{invoice_id}/transactions
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
Resource object representing transaction.
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
Retrieve a transaction identified by its unique id.
Sample Request
curl  https://{site}.chargebee.com/api/v1/transactions/txn_3Nl8YKPQ8YayJEE \
     -u {site_api_key}:
copy
curl  https://{site}.chargebee.com/api/v1/transactions/txn_3Nl8YKPQ8YayJEE \
     -u {site_api_key}:

Sample Response [ JSON ]

{"transaction": { "id": "txn_3Nl8YKPQ8YayJEE", "customer_id": "8avVGOkx8U1MX", "subscription_id": "8avVGOkx8U1MX", "payment_method": "card", "gateway": "chargebee", "type": "payment", "date": 1414780231, "amount": 900, "id_at_gateway": "cb_3Nl8YKPQ8YayJbF", "status": "success", "object": "transaction", "masked_card_number": "************1111", "currency_code": "USD", "amount_unused": 0, "linked_invoices": [ { "invoice_id": "1", "applied_amount": 900, "applied_at": 1414780231, "invoice_date": 1414780230, "invoice_amount": 900 }, {..} ], "linked_refunds": [] }}

URL Format GET

https://{site}.chargebee.com/api/v1/transactions/{transaction_id}
Resource object representing transaction.
always returned

Sample admin console URL

https://{site}.chargebee.com/admin-console/transactions/txn_3Nl8YKPQ8YayJEE

To record offline payments (Cash,Check etc) for 'payment_due' or 'not_paid' invoices.

The invoice status will be marked as 'paid' when the amount that is due is recorded.

Sample Request
curl  https://{site}.chargebee.com/api/v1/invoices/8/record_payment \
     -u {site_api_key}: \
     -d payment_method="bank_transfer" \
     -d paid_at="1394532759"
copy
curl  https://{site}.chargebee.com/api/v1/invoices/8/record_payment \
     -u {site_api_key}: \
     -d payment_method="bank_transfer" \
     -d paid_at="1394532759"

Sample Response [ JSON ]

{ "transaction": { "id": "txn_3Nl8YTUQ8YbQbF7I", "customer_id": "3Nl8YKPQ8YbN805k", "subscription_id": "3Nl8YKPQ8YbN805k", "payment_method": "bank_transfer", "gateway": "not_applicable", "type": "payment", "date": 1394532759, "amount": 1000, "status": "success", "object": "transaction", "currency_code": "USD", "amount_unused": 0, "linked_invoices": [ { "invoice_id": "31", "applied_amount": 1000, "applied_at": 1484646503, "invoice_date": 1484394490, "invoice_amount": 1000 }, {..} ], "linked_refunds": [] }, "invoice": { "id": "31", "customer_id": "3Nl8YKPQ8YbN805k", "subscription_id": "3Nl8YKPQ8YbN805k", "recurring": true, "status": "paid", "price_type": "tax_exclusive", "start_date": 1484300890, "end_date": 1484394490, "amount": 1000, "amount_paid": 1000, "amount_adjusted": 0, "credits_applied": 0, "amount_due": 0, "paid_on": 1394532759, "dunning_status": "stopped", "object": "invoice", "first_invoice": false, "currency_code": "USD", "tax": 0, "line_items": [ { "date_from": 1484394490, "date_to": 1487072890, "unit_amount": 1000, "quantity": 1, "is_taxed": false, "tax": 0, "object": "line_item", "amount": 1000, "description": "No Trial", "type": "charge", "entity_type": "plan", "entity_id": "no_trial" }, {..} ], "sub_total": 1000, "linked_transactions": [ { "txn_id": "txn_3Nl8YTUQ8YbQbF7I", "applied_amount": 1000, "applied_at": 1484646503, "txn_type": "payment", "txn_status": "success", "txn_date": 1394532759, "txn_amount": 1000 }, {..} ], "linked_orders": [], "billing_address": { "first_name": "Rachel", "last_name": "Green", "object": "billing_address" } } }

URL Format POST

https://{site}.chargebee.com/api/v1/invoices/{invoice_id}/record_payment
amount
Amount paid. If this parameter is not passed then the entire invoice due amount will be recorded.
optional, in cents, min=1
payment_method
The Payment Method of this transaction.
required, enumerated string, default=card
Possible values are
cashCash.checkCheck.
bank_transferBank Transfer.direct_debitDirect Debit.otherPayment Methods other than the above types.
Show all values[+]
paid_at
Indicates when this transaction occurred.
required, timestamp(UTC) in seconds
reference_number
The reference number for this transaction. e.g check number in case of 'check' payments.
optional, string, max chars=100
memo
A short description or note regarding the payment received. This will be the description in the transaction created.
optional, string, max chars=300
Resource object representing transaction.
always returned
Resource object representing invoice.
always returned