API Version
Product Catalog
Library

Updates
This API obsoletes the Cards API in Chargebee.

Represents the payment source for the customer. Specific types of payment source (Card, Direct Debit, Paypal Express Checkout, etc.) is defined as sub-resource in the response object. You can find the list of supported payment sources and the expected input parameters here. See Payment source attributes for a descriptive list of attributes and payment source types.

Sample payment source [ JSON ]

{ "card": { "brand": "visa", "expiry_month": 5, "expiry_year": 2022, "first_name": "MyCard", "funding_type": "credit", "iin": "******", "last4": "4242", "last_name": "testing", "masked_number": "************4242", "object": "card" }, "created_at": 1517487233, "customer_id": "__test__XpbTXGTSRp4QZ1EK", "deleted": false, "gateway": "stripe", "gateway_account_id": "gw___test__5SK2lMpwSRp4Mx02v", "id": "pm___test__XpbTXGTSRp4R8ZEN", "issuing_country": "US", "object": "payment_source", "reference_id": "cus_J7rVykqiooX1ng/card_1IVbmWJv9j0DyntJS7Bzo5q5", "resource_version": 1517487233588, "status": "valid", "type": "card", "updated_at": 1517487233 }

API Index URL GET

https://{site}.chargebee.com/api/v2/payment_sources

Model Class

id
string, max chars=40
Identifier of the payment source
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 payment source resource was last updated.
created_at
timestamp(UTC) in seconds
Timestamp indicating when this payment source resource is created.
customer_id
string, max chars=50
Identifier of the customer with whom this payment source is associated.
type
enumerated string
Type of payment source
Possible values are
cardCard based payment including credit cards and debit cards. Details about the card can be obtained from the card resource.paypal_express_checkoutPayments made via PayPal Express Checkout.amazon_paymentsPayments made via Amazon Payments.direct_debitRepresents bank account for which the direct debit or ACH agreement/mandate is created.genericPayments made via Generic Payment Method.alipayPayments made via Alipay.
This payment source is deprecated.
unionpayPayments made via UnionPay.apple_payPayments made via Apple Pay.wechat_payPayments made via WeChat Pay.
This payment source is deprecated.
idealPayments made via iDEAL.google_payPayments made via Google Pay.sofortPayments made via Sofort.bancontactPayments made via Bancontact Card.giropayPayments made via giropay.dotpayPayments made via Dotpay.upiUPI Payments.netbanking_emandatesNetbanking (eMandates) Payments.venmoPayments made via Venmo pay_toPayments made via PayTo faster_paymentsPayments made via Faster Payments sepa_instant_transferPayments made via Sepa Instant Transfer automated_bank_transferRepresents virtual bank account using which the payment will be done. klarna_pay_nowPayments made via Klarna Pay Now online_banking_polandPayments made via Online Banking Poland
cardCard based payment including credit cards and debit cards. Details about the card can be obtained from the card resource.paypal_express_checkoutPayments made via PayPal Express Checkout.amazon_paymentsPayments made via Amazon Payments.direct_debitRepresents bank account for which the direct debit or ACH agreement/mandate is created.
genericPayments made via Generic Payment Method.alipayPayments made via Alipay.
This payment source is deprecated.
unionpayPayments made via UnionPay.apple_payPayments made via Apple Pay.wechat_payPayments made via WeChat Pay.
This payment source is deprecated.
idealPayments made via iDEAL.google_payPayments made via Google Pay.sofortPayments made via Sofort.bancontactPayments made via Bancontact Card.giropayPayments made via giropay.dotpayPayments made via Dotpay.upiUPI Payments.netbanking_emandatesNetbanking (eMandates) Payments.venmoPayments made via Venmo pay_toPayments made via PayTo faster_paymentsPayments made via Faster Payments sepa_instant_transferPayments made via Sepa Instant Transfer automated_bank_transferRepresents virtual bank account using which the payment will be done. klarna_pay_nowPayments made via Klarna Pay Now online_banking_polandPayments made via Online Banking Poland
Show all values[+]
reference_id
string, max chars=200
The reference id. In the case of Amazon and PayPal this will be the 'billing agreement id'. For GoCardless direct debit this will be 'mandate id'. In the case of card payments this will be the identifier provided by the gateway/card vault for the specific payment method resource.
Note: This is not the one time temporary token provided by gateways like Stripe.

status
enumerated string, default=valid
Current status of the payment source.
Possible values are
validA payment source that is valid and active.expiringA payment source that is expiring (like card's status based on its expiry date).expiredA payment source that has expiredinvalidThe billing agreement cannot be used. It might become valid again either automatically or due to customer action.pending_verificationThe payment source needs to be verified
validA payment source that is valid and active.expiringA payment source that is expiring (like card's status based on its expiry date).expiredA payment source that has expiredinvalidThe billing agreement cannot be used. It might become valid again either automatically or due to customer action.
pending_verificationThe payment source needs to be verified
Show all values[+]
gateway
enumerated string
Name of the gateway this payment source is stored with.
Possible values are
chargebeeChargebee test gateway.chargebee_paymentsChargebee Payments gatewayadyenAdyen is a payment gateway.stripeStripe is a payment gateway.wepayWePay is a payment gateway.braintreeBraintree is a payment gateway.authorize_netAuthorize.net is a payment gatewaypaypal_proPayPal Pro Account is a payment gateway.pinPin is a payment gatewayewayeWAY Account is a payment gateway.eway_rapideWAY Rapid is a payment gateway.worldpayWorldPay is a payment gatewaybalanced_paymentsBalanced is a payment gatewaybeanstreamBambora(formerly known as Beanstream) is a payment gateway.bluepayBluePay is a payment gateway.elavonElavon Virtual Merchant is a payment solution.first_data_globalFirst Data Global Gateway Virtual Terminal AccounthdfcHDFC Account is a payment gateway.migsMasterCard Internet Gateway Service payment gateway.nmiNMI is a payment gateway.ogoneIngenico ePayments (formerly known as Ogone) is a payment gateway.paymillPAYMILL is a payment gateway.paypal_payflow_proPayPal Payflow Pro is a payment gateway.sage_paySage Pay is a payment gateway.tco2Checkout is a payment gateway.wirecardWireCard Account is a payment service provider.amazon_paymentsAmazon Payments is a payment service provider.paypal_express_checkoutPayPal Express Checkout is a payment gateway.gocardlessGoCardless is a payment service provider.orbitalChase Paymentech(Orbital) is a payment gateway.moneris_usMoneris USA is a payment gateway.monerisMoneris is a payment gateway.bluesnapBlueSnap is a payment gateway.cybersourceCyberSource is a payment gateway.vantivVantiv is a payment gateway.checkout_comCheckout.com is a payment gateway.paypalPayPal Commerce is a payment gateway.ingenico_directWorldline Online Payments is a payment gateway.exactExact Payments is a payment gateway.mollieMollie is a payment gateway.quickbooksIntuit QuickBooks Payments gatewayrazorpayRazorpay is a fast growing payment service provider in India working with all leading banks and support for major local payment methods including Netbanking, UPI etc.global_paymentsGlobal Payments is a payment service provider.bank_of_americaBank of America GatewayecentricEcentric provides a seamless payment processing service in South Africa specializing on omnichannel capabilities.metrics_globalMetrics global is a leading payment service provider providing unified payment services in the US.windcaveWindcave provides an end to end payment processing solution in ANZ and other leading global markets.pay_comPay.com provides payment services focused on simplicity and hassle-free operations for businesses of all sizes.ebanxEBANX is a payment gateway, enabling businesses to accept diverse local payment methods from various countries for increased market reach and conversion.dlocalDlocal provides payment solutions for global commerce by accepting local payment methods.nuveiNuvei is a secure and reliable payment processing solution that allows you to accept payments from customers and suitable for various types of businesses. paystackPaystack is a payment gateway for businesses in Africa. It enables secure payment acceptance both online and offline. jp_morgannot_applicableIndicates that payment gateway is not applicable for this resource.
chargebeeChargebee test gateway.chargebee_paymentsChargebee Payments gatewayadyenAdyen is a payment gateway.stripeStripe is a payment gateway.
wepayWePay is a payment gateway.braintreeBraintree is a payment gateway.authorize_netAuthorize.net is a payment gatewaypaypal_proPayPal Pro Account is a payment gateway.pinPin is a payment gatewayewayeWAY Account is a payment gateway.eway_rapideWAY Rapid is a payment gateway.worldpayWorldPay is a payment gatewaybalanced_paymentsBalanced is a payment gatewaybeanstreamBambora(formerly known as Beanstream) is a payment gateway.bluepayBluePay is a payment gateway.elavonElavon Virtual Merchant is a payment solution.first_data_globalFirst Data Global Gateway Virtual Terminal AccounthdfcHDFC Account is a payment gateway.migsMasterCard Internet Gateway Service payment gateway.nmiNMI is a payment gateway.ogoneIngenico ePayments (formerly known as Ogone) is a payment gateway.paymillPAYMILL is a payment gateway.paypal_payflow_proPayPal Payflow Pro is a payment gateway.sage_paySage Pay is a payment gateway.tco2Checkout is a payment gateway.wirecardWireCard Account is a payment service provider.amazon_paymentsAmazon Payments is a payment service provider.paypal_express_checkoutPayPal Express Checkout is a payment gateway.gocardlessGoCardless is a payment service provider.orbitalChase Paymentech(Orbital) is a payment gateway.moneris_usMoneris USA is a payment gateway.monerisMoneris is a payment gateway.bluesnapBlueSnap is a payment gateway.cybersourceCyberSource is a payment gateway.vantivVantiv is a payment gateway.checkout_comCheckout.com is a payment gateway.paypalPayPal Commerce is a payment gateway.ingenico_directWorldline Online Payments is a payment gateway.exactExact Payments is a payment gateway.mollieMollie is a payment gateway.quickbooksIntuit QuickBooks Payments gatewayrazorpayRazorpay is a fast growing payment service provider in India working with all leading banks and support for major local payment methods including Netbanking, UPI etc.global_paymentsGlobal Payments is a payment service provider.bank_of_americaBank of America GatewayecentricEcentric provides a seamless payment processing service in South Africa specializing on omnichannel capabilities.metrics_globalMetrics global is a leading payment service provider providing unified payment services in the US.windcaveWindcave provides an end to end payment processing solution in ANZ and other leading global markets.pay_comPay.com provides payment services focused on simplicity and hassle-free operations for businesses of all sizes.ebanxEBANX is a payment gateway, enabling businesses to accept diverse local payment methods from various countries for increased market reach and conversion.dlocalDlocal provides payment solutions for global commerce by accepting local payment methods.nuveiNuvei is a secure and reliable payment processing solution that allows you to accept payments from customers and suitable for various types of businesses. paystackPaystack is a payment gateway for businesses in Africa. It enables secure payment acceptance both online and offline. jp_morgannot_applicableIndicates that payment gateway is not applicable for this resource.
Show all values[+]
gateway_account_id
optional, string, max chars=50
The gateway account to which this payment source is stored with.
ip_address
optional, string, max chars=50
The IP address of the customer. Used primarily for referral integration and EU VAT validation.
issuing_country
optional, string, max chars=50
two-letter(alpha2) ISO country code.
deleted
boolean
Indicates that this resource has been deleted.
business_entity_id
optional, string, max chars=50
The unique ID of the business entity of this payment_source. This is always the same as the business entity of the customer.

optional, card
Card details associated with this payment source.
bank_account
Show attributes [+]
optional, bank_account
Bank account details the direct debit or ACH or NetBanking agreement/mandate created with this payment source.
optional, cust_voucher_source
Boleto payment source details of the customer
billing_address
Show attributes [+]
optional, billing_address
Billing address for the payment source.
amazon_payment
Show attributes [+]
optional, amazon_payment
Amazon payments details associated with this payment source.
optional, upi
Represents the payment method that allows you to make payments directly using a bank account.
optional, paypal
PayPal Express Checkout details associated with this payment source.
optional, venmo
Venmo details associated with this payment source.
klarna_pay_now
Show attributes [+]
optional, klarna_pay_now
Klarna Pay Now payment source details of the customer
optional, list of mandate
Mandate details associated with the payment source.
id id
string, max chars=40
Identifier of the payment source
resource_version 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 updated_at
optional, timestamp(UTC) in seconds
Timestamp indicating when this payment source resource was last updated.
created_at created_at
timestamp(UTC) in seconds
Timestamp indicating when this payment source resource is created.
customer_id customer_id
string, max chars=50
Identifier of the customer with whom this payment source is associated.
type type
enumerated string
Type of payment source
Possible values are
cardCard based payment including credit cards and debit cards. Details about the card can be obtained from the card resource.paypal_express_checkoutPayments made via PayPal Express Checkout.amazon_paymentsPayments made via Amazon Payments.direct_debitRepresents bank account for which the direct debit or ACH agreement/mandate is created.genericPayments made via Generic Payment Method.alipayPayments made via Alipay.
This payment source is deprecated.
unionpayPayments made via UnionPay.apple_payPayments made via Apple Pay.wechat_payPayments made via WeChat Pay.
This payment source is deprecated.
idealPayments made via iDEAL.google_payPayments made via Google Pay.sofortPayments made via Sofort.bancontactPayments made via Bancontact Card.giropayPayments made via giropay.dotpayPayments made via Dotpay.upiUPI Payments.netbanking_emandatesNetbanking (eMandates) Payments.venmoPayments made via Venmo pay_toPayments made via PayTo faster_paymentsPayments made via Faster Payments sepa_instant_transferPayments made via Sepa Instant Transfer automated_bank_transferRepresents virtual bank account using which the payment will be done. klarna_pay_nowPayments made via Klarna Pay Now online_banking_polandPayments made via Online Banking Poland
cardCard based payment including credit cards and debit cards. Details about the card can be obtained from the card resource.paypal_express_checkoutPayments made via PayPal Express Checkout.amazon_paymentsPayments made via Amazon Payments.direct_debitRepresents bank account for which the direct debit or ACH agreement/mandate is created.
genericPayments made via Generic Payment Method.alipayPayments made via Alipay.
This payment source is deprecated.
unionpayPayments made via UnionPay.apple_payPayments made via Apple Pay.wechat_payPayments made via WeChat Pay.
This payment source is deprecated.
idealPayments made via iDEAL.google_payPayments made via Google Pay.sofortPayments made via Sofort.bancontactPayments made via Bancontact Card.giropayPayments made via giropay.dotpayPayments made via Dotpay.upiUPI Payments.netbanking_emandatesNetbanking (eMandates) Payments.venmoPayments made via Venmo pay_toPayments made via PayTo faster_paymentsPayments made via Faster Payments sepa_instant_transferPayments made via Sepa Instant Transfer automated_bank_transferRepresents virtual bank account using which the payment will be done. klarna_pay_nowPayments made via Klarna Pay Now online_banking_polandPayments made via Online Banking Poland
Show all values[+]
reference_id reference_id
string, max chars=200
The reference id. In the case of Amazon and PayPal this will be the 'billing agreement id'. For GoCardless direct debit this will be 'mandate id'. In the case of card payments this will be the identifier provided by the gateway/card vault for the specific payment method resource.
Note: This is not the one time temporary token provided by gateways like Stripe.

status status
enumerated string, default=valid
Current status of the payment source.
Possible values are
validA payment source that is valid and active.expiringA payment source that is expiring (like card's status based on its expiry date).expiredA payment source that has expiredinvalidThe billing agreement cannot be used. It might become valid again either automatically or due to customer action.pending_verificationThe payment source needs to be verified
validA payment source that is valid and active.expiringA payment source that is expiring (like card's status based on its expiry date).expiredA payment source that has expiredinvalidThe billing agreement cannot be used. It might become valid again either automatically or due to customer action.
pending_verificationThe payment source needs to be verified
Show all values[+]
gateway gateway
enumerated string
Name of the gateway this payment source is stored with.
Possible values are
chargebeeChargebee test gateway.chargebee_paymentsChargebee Payments gatewayadyenAdyen is a payment gateway.stripeStripe is a payment gateway.wepayWePay is a payment gateway.braintreeBraintree is a payment gateway.authorize_netAuthorize.net is a payment gatewaypaypal_proPayPal Pro Account is a payment gateway.pinPin is a payment gatewayewayeWAY Account is a payment gateway.eway_rapideWAY Rapid is a payment gateway.worldpayWorldPay is a payment gatewaybalanced_paymentsBalanced is a payment gatewaybeanstreamBambora(formerly known as Beanstream) is a payment gateway.bluepayBluePay is a payment gateway.elavonElavon Virtual Merchant is a payment solution.first_data_globalFirst Data Global Gateway Virtual Terminal AccounthdfcHDFC Account is a payment gateway.migsMasterCard Internet Gateway Service payment gateway.nmiNMI is a payment gateway.ogoneIngenico ePayments (formerly known as Ogone) is a payment gateway.paymillPAYMILL is a payment gateway.paypal_payflow_proPayPal Payflow Pro is a payment gateway.sage_paySage Pay is a payment gateway.tco2Checkout is a payment gateway.wirecardWireCard Account is a payment service provider.amazon_paymentsAmazon Payments is a payment service provider.paypal_express_checkoutPayPal Express Checkout is a payment gateway.gocardlessGoCardless is a payment service provider.orbitalChase Paymentech(Orbital) is a payment gateway.moneris_usMoneris USA is a payment gateway.monerisMoneris is a payment gateway.bluesnapBlueSnap is a payment gateway.cybersourceCyberSource is a payment gateway.vantivVantiv is a payment gateway.checkout_comCheckout.com is a payment gateway.paypalPayPal Commerce is a payment gateway.ingenico_directWorldline Online Payments is a payment gateway.exactExact Payments is a payment gateway.mollieMollie is a payment gateway.quickbooksIntuit QuickBooks Payments gatewayrazorpayRazorpay is a fast growing payment service provider in India working with all leading banks and support for major local payment methods including Netbanking, UPI etc.global_paymentsGlobal Payments is a payment service provider.bank_of_americaBank of America GatewayecentricEcentric provides a seamless payment processing service in South Africa specializing on omnichannel capabilities.metrics_globalMetrics global is a leading payment service provider providing unified payment services in the US.windcaveWindcave provides an end to end payment processing solution in ANZ and other leading global markets.pay_comPay.com provides payment services focused on simplicity and hassle-free operations for businesses of all sizes.ebanxEBANX is a payment gateway, enabling businesses to accept diverse local payment methods from various countries for increased market reach and conversion.dlocalDlocal provides payment solutions for global commerce by accepting local payment methods.nuveiNuvei is a secure and reliable payment processing solution that allows you to accept payments from customers and suitable for various types of businesses. paystackPaystack is a payment gateway for businesses in Africa. It enables secure payment acceptance both online and offline. jp_morgannot_applicableIndicates that payment gateway is not applicable for this resource.
chargebeeChargebee test gateway.chargebee_paymentsChargebee Payments gatewayadyenAdyen is a payment gateway.stripeStripe is a payment gateway.
wepayWePay is a payment gateway.braintreeBraintree is a payment gateway.authorize_netAuthorize.net is a payment gatewaypaypal_proPayPal Pro Account is a payment gateway.pinPin is a payment gatewayewayeWAY Account is a payment gateway.eway_rapideWAY Rapid is a payment gateway.worldpayWorldPay is a payment gatewaybalanced_paymentsBalanced is a payment gatewaybeanstreamBambora(formerly known as Beanstream) is a payment gateway.bluepayBluePay is a payment gateway.elavonElavon Virtual Merchant is a payment solution.first_data_globalFirst Data Global Gateway Virtual Terminal AccounthdfcHDFC Account is a payment gateway.migsMasterCard Internet Gateway Service payment gateway.nmiNMI is a payment gateway.ogoneIngenico ePayments (formerly known as Ogone) is a payment gateway.paymillPAYMILL is a payment gateway.paypal_payflow_proPayPal Payflow Pro is a payment gateway.sage_paySage Pay is a payment gateway.tco2Checkout is a payment gateway.wirecardWireCard Account is a payment service provider.amazon_paymentsAmazon Payments is a payment service provider.paypal_express_checkoutPayPal Express Checkout is a payment gateway.gocardlessGoCardless is a payment service provider.orbitalChase Paymentech(Orbital) is a payment gateway.moneris_usMoneris USA is a payment gateway.monerisMoneris is a payment gateway.bluesnapBlueSnap is a payment gateway.cybersourceCyberSource is a payment gateway.vantivVantiv is a payment gateway.checkout_comCheckout.com is a payment gateway.paypalPayPal Commerce is a payment gateway.ingenico_directWorldline Online Payments is a payment gateway.exactExact Payments is a payment gateway.mollieMollie is a payment gateway.quickbooksIntuit QuickBooks Payments gatewayrazorpayRazorpay is a fast growing payment service provider in India working with all leading banks and support for major local payment methods including Netbanking, UPI etc.global_paymentsGlobal Payments is a payment service provider.bank_of_americaBank of America GatewayecentricEcentric provides a seamless payment processing service in South Africa specializing on omnichannel capabilities.metrics_globalMetrics global is a leading payment service provider providing unified payment services in the US.windcaveWindcave provides an end to end payment processing solution in ANZ and other leading global markets.pay_comPay.com provides payment services focused on simplicity and hassle-free operations for businesses of all sizes.ebanxEBANX is a payment gateway, enabling businesses to accept diverse local payment methods from various countries for increased market reach and conversion.dlocalDlocal provides payment solutions for global commerce by accepting local payment methods.nuveiNuvei is a secure and reliable payment processing solution that allows you to accept payments from customers and suitable for various types of businesses. paystackPaystack is a payment gateway for businesses in Africa. It enables secure payment acceptance both online and offline. jp_morgannot_applicableIndicates that payment gateway is not applicable for this resource.
Show all values[+]
gateway_account_id gateway_account_id
optional, string, max chars=50
The gateway account to which this payment source is stored with.
ip_address ip_address
optional, string, max chars=50
The IP address of the customer. Used primarily for referral integration and EU VAT validation.
issuing_country issuing_country
optional, string, max chars=50
two-letter(alpha2) ISO country code.
deleted deleted
boolean
Indicates that this resource has been deleted.
business_entity_id business_entity_id
optional, string, max chars=50
The unique ID of the business entity of this payment_source. This is always the same as the business entity of the customer.

card
optional, card
Card details associated with this payment source.
bank_account
optional, bank_account
Bank account details the direct debit or ACH or NetBanking agreement/mandate created with this payment source.
boleto
optional, cust_voucher_source
Boleto payment source details of the customer
billing_address
optional, billing_address
Billing address for the payment source.
amazon_payment
optional, amazon_payment
Amazon payments details associated with this payment source.
upi
optional, upi
Represents the payment method that allows you to make payments directly using a bank account.
paypal
optional, paypal
PayPal Express Checkout details associated with this payment source.
venmo
optional, venmo
Venmo details associated with this payment source.
klarna_pay_now
optional, klarna_pay_now
Klarna Pay Now payment source details of the customer
mandates
optional, list of mandate
Mandate details associated with the payment source.

This API offers an alternative way to create a payment source using a single-use gateway temporary token, which is generally provided by your payment gateway. In the case of Stripe, this temporary token is generated according to the instruction detailed in Stripe documentation.

Storing card after successful 3DS completion is not supported in this API. Use create using Payment Intent API under Payment source to store the card after successful 3DS flow completion.

Notes

Sample Request
curl  https://{site}.chargebee.com/api/v2/payment_sources/create_using_temp_token \
     -u {site_api_key}:\
     -d gateway_account_id="gw___test__5SK2lMpwSRp4Mx02v" \
     -d customer_id="__test__XpbTXGTSRp4QZ1EK" \
     -d type="CARD" \
     -d tmp_token="tok_1IVbmWJv9j0DyntJuLTiAhzK"
copy
Click to Copy
curl  https://{site}.chargebee.com/api/v2/payment_sources/create_using_temp_token \
     -u {site_api_key}:\
     -d gateway_account_id="gw___test__5SK2lMpwSRp4Mx02v" \
     -d customer_id="__test__XpbTXGTSRp4QZ1EK" \
     -d type="CARD" \
     -d tmp_token="tok_1IVbmWJv9j0DyntJuLTiAhzK"

Sample Response [ JSON ]

Show more...
{
    "customer": {
        "allow_direct_debit": false,
        "auto_collection": "on",
        "card_status": "valid",
        "created_at": 1517487231,
        "deleted": false,
        "excess_payments": 0,
        "first_name": "Mark",
        "id": "__test__XpbTXGTSRp4QZ1EK",
        "last_name": "Henry",
        "net_term_days": 0,
        "object": "customer",
        "payment_method": {
            "gateway": "stripe",
            "gateway_account_id": "gw___test__5SK2lMpwSRp4Mx02v",
            "object": "payment_method",
            "reference_id": "cus_J7rVykqiooX1ng/card_1IVbmWJv9j0DyntJS7Bzo5q5",
            "status": "valid",
            "type": "card"
        },
        "pii_cleared": "active",
        "preferred_currency_code": "USD",
        "primary_payment_source_id": "pm___test__XpbTXGTSRp4R8ZEN",
        "promotional_credits": 0,
        "refundable_credits": 0,
        "resource_version": 1517487233590,
        "taxability": "taxable",
        "unbilled_charges": 0,
        "updated_at": 1517487233
    },
    "payment_source": {
        "card": {
            "brand": "visa",
            "expiry_month": 5,
            "expiry_year": 2022,
            "first_name": "MyCard",
            "funding_type": "credit",
            "iin": "******",
            "last4": "4242",
            "last_name": "testing",
            "masked_number": "************4242",
            "object": "card"
        },
        "created_at": 1517487233,
        "customer_id": "__test__XpbTXGTSRp4QZ1EK",
        "deleted": false,
        "gateway": "stripe",
        "gateway_account_id": "gw___test__5SK2lMpwSRp4Mx02v",
        "id": "pm___test__XpbTXGTSRp4R8ZEN",
        "issuing_country": "US",
        "object": "payment_source",
        "reference_id": "cus_J7rVykqiooX1ng/card_1IVbmWJv9j0DyntJS7Bzo5q5",
        "resource_version": 1517487233588,
        "status": "valid",
        "type": "card",
        "updated_at": 1517487233
    }
}

URL Format POST

https://{site}.chargebee.com/api/v2/payment_sources/create_using_temp_token

Method

customer_id[]
required, string, max chars=50
Identifier of the customer with whom this payment source is associated.
gateway_account_id[]
optional, string, max chars=50
The gateway account to which the payment source is associated.
type[]
required, enumerated string
Type of payment source.
Possible values are
cardCard based payment including credit cards and debit cards. Details about the card can be obtained from the card resource.paypal_express_checkoutPayments made via PayPal Express Checkout.amazon_paymentsPayments made via Amazon Payments.direct_debitRepresents bank account for which the direct debit or ACH agreement/mandate is created.genericPayments made via Generic Payment Method.alipayPayments made via Alipay.
This payment source is deprecated.
unionpayPayments made via UnionPay.apple_payPayments made via Apple Pay.wechat_payPayments made via WeChat Pay.
This payment source is deprecated.
idealPayments made via iDEAL.google_payPayments made via Google Pay.sofortPayments made via Sofort.bancontactPayments made via Bancontact Card.giropayPayments made via giropay.dotpayPayments made via Dotpay.upiUPI Payments.netbanking_emandatesNetbanking (eMandates) Payments.venmoPayments made via Venmo pay_toPayments made via PayTo faster_paymentsPayments made via Faster Payments sepa_instant_transferPayments made via Sepa Instant Transfer automated_bank_transferRepresents virtual bank account using which the payment will be done. klarna_pay_nowPayments made via Klarna Pay Now online_banking_poland
cardCard based payment including credit cards and debit cards. Details about the card can be obtained from the card resource.paypal_express_checkoutPayments made via PayPal Express Checkout.amazon_paymentsPayments made via Amazon Payments.direct_debitRepresents bank account for which the direct debit or ACH agreement/mandate is created.
genericPayments made via Generic Payment Method.alipayPayments made via Alipay.
This payment source is deprecated.
unionpayPayments made via UnionPay.apple_payPayments made via Apple Pay.wechat_payPayments made via WeChat Pay.
This payment source is deprecated.
idealPayments made via iDEAL.google_payPayments made via Google Pay.sofortPayments made via Sofort.bancontactPayments made via Bancontact Card.giropayPayments made via giropay.dotpayPayments made via Dotpay.upiUPI Payments.netbanking_emandatesNetbanking (eMandates) Payments.venmoPayments made via Venmo pay_toPayments made via PayTo faster_paymentsPayments made via Faster Payments sepa_instant_transferPayments made via Sepa Instant Transfer automated_bank_transferRepresents virtual bank account using which the payment will be done. klarna_pay_nowPayments made via Klarna Pay Now online_banking_poland
Show all values[+]
tmp_token[]
required, string, max chars=65k
Single-use token created by payment gateways. In Stripe, a single-use token is created for Apple Pay Wallet, card details or direct debit. In Braintree, a nonce is created for Apple Pay Wallet, PayPal, or card details. In Authorize.net, a nonce is created for card details. In Adyen, an encrypted data is created from the card details.
issuing_country[]
optional, string, max chars=50
2-letter (alpha2) ISO country code. Indicates your customer's payment method country of issuance. Applicable for PayPal via Braintree.
replace_primary_payment_source[]
optional, boolean, default=false
Indicates whether the primary payment source should be replaced with this payment source. In case of Create Subscription for Customer endpoint, the default value is True. Otherwise, the default value is False.
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.
      • document: Document ID is the user’s identification number based on their country.
  • bluesnap: While passing raw card details to BlueSnap, if fraud_session_id is added, additional validation is performed to avoid fraudulent transactions.
    • fraud: Fraud identification related information.
  • 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.
  • bank_of_america: While passing raw card details to Bank of America, your 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.
  • ecentric: This parameter is used to verify and process payment method details in Ecentric. If the merchant_id parameter is included, Chargebee will vault it / perform a lookup and verification against this merchant_id, overriding the one configured in Chargebee. If tokens and processing occur in the same Merchant GUID, you can just skip this part.
    • merchant_id: Merchant GUID where the card is vaulted or need to be vaulted.
  • ebanx: While passing raw card details to EBANX, the user's document is required for some countries and device_session_id can be added to perform additional validation and avoid fraudulent transactions.
    • payer: User related information.
      • document: Document is the user's identification number based on their country.
    • fraud: Fraud identification related information.
      • device_session_id: Session ID associated with the user's device
.
customer customer
always returned
Resource object representing customer
payment_source payment_source
always returned
Resource object representing payment_source

Sample admin console URL

https://{site}.chargebee.com/admin-console/payment_sources/123x

This API provides an alternative way to create a payment source using a permanent token, instead of having to add the full payment method details via API or the Chargebee UI. Permanent tokens are provided by payment gateways such as Stripe.

Storing card after successful 3DS completion is not supported in this API. Use create using Payment Intent API under Payment source to store the card after successful 3DS flow completion.

Notes

Sample Request
curl  https://{site}.chargebee.com/api/v2/payment_sources/create_using_permanent_token \
     -u {site_api_key}:\
     -d customer_id="__test__XpbTXGTSRp4Q5TE9" \
     -d gateway_account_id="gw___test__5SK2lMpwSRp4Mx02v" \
     -d reference_id="cus_J7rVCB7oVNyDJF" \
     -d type="CARD"
copy
Click to Copy
curl  https://{site}.chargebee.com/api/v2/payment_sources/create_using_permanent_token \
     -u {site_api_key}:\
     -d customer_id="__test__XpbTXGTSRp4Q5TE9" \
     -d gateway_account_id="gw___test__5SK2lMpwSRp4Mx02v" \
     -d reference_id="cus_J7rVCB7oVNyDJF" \
     -d type="CARD"

Sample Response [ JSON ]

Show more...
{
    "customer": {
        "allow_direct_debit": false,
        "auto_collection": "on",
        "card_status": "valid",
        "created_at": 1517487229,
        "deleted": false,
        "excess_payments": 0,
        "first_name": "Mark",
        "id": "__test__XpbTXGTSRp4Q5TE9",
        "last_name": "Henry",
        "net_term_days": 0,
        "object": "customer",
        "payment_method": {
            "gateway": "stripe",
            "gateway_account_id": "gw___test__5SK2lMpwSRp4Mx02v",
            "object": "payment_method",
            "reference_id": "cus_J7rVCB7oVNyDJF/card_1IVbmUJv9j0DyntJninpvymH",
            "status": "valid",
            "type": "card"
        },
        "pii_cleared": "active",
        "preferred_currency_code": "USD",
        "primary_payment_source_id": "pm___test__XpbTXGTSRp4QTuEF",
        "promotional_credits": 0,
        "refundable_credits": 0,
        "resource_version": 1517487231068,
        "taxability": "taxable",
        "unbilled_charges": 0,
        "updated_at": 1517487231
    },
    "payment_source": {
        "card": {
            "brand": "visa",
            "expiry_month": 12,
            "expiry_year": 2022,
            "funding_type": "credit",
            "iin": "******",
            "last4": "1111",
            "masked_number": "************1111",
            "object": "card"
        },
        "created_at": 1517487231,
        "customer_id": "__test__XpbTXGTSRp4Q5TE9",
        "deleted": false,
        "gateway": "stripe",
        "gateway_account_id": "gw___test__5SK2lMpwSRp4Mx02v",
        "id": "pm___test__XpbTXGTSRp4QTuEF",
        "issuing_country": "US",
        "object": "payment_source",
        "reference_id": "cus_J7rVCB7oVNyDJF/card_1IVbmUJv9j0DyntJninpvymH",
        "resource_version": 1517487231066,
        "status": "valid",
        "type": "card",
        "updated_at": 1517487231
    }
}

URL Format POST

https://{site}.chargebee.com/api/v2/payment_sources/create_using_permanent_token

Method

customer_id[]
required, string, max chars=50
Identifier of the customer with whom this payment source is associated.
type[]
required, enumerated string
The type of payment method. For more details refer Update payment method for a customer API under Customer resource.
Possible values are
cardCard based payment including credit cards and debit cards. Details about the card can be obtained from the card resource.paypal_express_checkoutPayments made via PayPal Express Checkout.amazon_paymentsPayments made via Amazon Payments.direct_debitRepresents bank account for which the direct debit or ACH agreement/mandate is created.genericPayments made via Generic Payment Method.alipayPayments made via Alipay.
This payment source is deprecated.
unionpayPayments made via UnionPay.apple_payPayments made via Apple Pay.wechat_payPayments made via WeChat Pay.
This payment source is deprecated.
idealPayments made via iDEAL.google_payPayments made via Google Pay.sofortPayments made via Sofort.bancontactPayments made via Bancontact Card.giropayPayments made via giropay.dotpayPayments made via Dotpay.upiUPI Payments.netbanking_emandatesNetbanking (eMandates) Payments.venmoPayments made via Venmo pay_toPayments made via PayTo faster_paymentsPayments made via Faster Payments sepa_instant_transferPayments made via Sepa Instant Transfer automated_bank_transferRepresents virtual bank account using which the payment will be done. klarna_pay_nowPayments made via Klarna Pay Now online_banking_poland
cardCard based payment including credit cards and debit cards. Details about the card can be obtained from the card resource.paypal_express_checkoutPayments made via PayPal Express Checkout.amazon_paymentsPayments made via Amazon Payments.direct_debitRepresents bank account for which the direct debit or ACH agreement/mandate is created.
genericPayments made via Generic Payment Method.alipayPayments made via Alipay.
This payment source is deprecated.
unionpayPayments made via UnionPay.apple_payPayments made via Apple Pay.wechat_payPayments made via WeChat Pay.
This payment source is deprecated.
idealPayments made via iDEAL.google_payPayments made via Google Pay.sofortPayments made via Sofort.bancontactPayments made via Bancontact Card.giropayPayments made via giropay.dotpayPayments made via Dotpay.upiUPI Payments.netbanking_emandatesNetbanking (eMandates) Payments.venmoPayments made via Venmo pay_toPayments made via PayTo faster_paymentsPayments made via Faster Payments sepa_instant_transferPayments made via Sepa Instant Transfer automated_bank_transferRepresents virtual bank account using which the payment will be done. klarna_pay_nowPayments made via Klarna Pay Now online_banking_poland
Show all values[+]
gateway_account_id[]
optional, string, max chars=50
The gateway account to which the payment source is associated.
reference_id[]
optional, string, max chars=200

The reference id. In the case of Amazon and PayPal, this will be the billing agreement ID. For GoCardless direct debit this will be mandate_id. In the case of a card, this will be the identifier provided by the gateway or card vault for the specific payment method resource.

Note:

  • This is not the one-time temporary token provided by gateways like Stripe.

  • reference_id is an alternative for payment_method_token, customer_profile_token, network_transaction_id, or mandate_id.

  • payment_method_token, customer_profile_token, network_transaction_id, or mandate_id cannot be used with reference_id.

  • reference_id is a combination of multiple tokens available at the gateway. Learn more about the combination of each gateway from this document.

issuing_country[]
optional, string, max chars=50
2-letter (alpha2) ISO country code. Indicates your customer's payment method country of issuance. Applicable for PayPal via Braintree.
replace_primary_payment_source[]
optional, boolean, default=false
Indicates whether the primary payment source should be replaced with this payment source. In case of Create Subscription for Customer endpoint, the default value is True. Otherwise, the default value is False.
payment_method_token[]
optional, string, max chars=100

An identifier provided by the gateway or card vault for the specific payment method resource.

Note:

payment_method_token is an alternative for reference_id and cannot be used with reference_id.

customer_profile_token[]
optional, string, max chars=100

A unique identifier associated with a customer`s profile within a payment gateway.

Note:

customer_profile_token is an alternative for reference_id and cannot be used with reference_id.

network_transaction_id[]
optional, string, max chars=100

An identifier of the payment or authorization transaction at the gateway initiated using this payment method.

Note:

network_transaction_id is an alternative for reference_id and cannot be used with reference_id.

mandate_id[]
optional, string, max chars=100

An identifier of mandates which is an authorization given by the payer (usually a customer or account holder) to allow a third party such as a merchant or service provider to initiate payments from their account.

Note:

mandate_id is an alternative for reference_id and cannot be used with reference_id.

skip_retrieval[]
optional, boolean, default=false

By default, the value is false and payment method details will be retrieved from the selected payment gateway using reference_id or payment_method_token / customer_profile_token / network_transaction_id / mandate_id. Learn more about the multiple token combinations of each gateway from this document.

Enter the value as true for the payment gateways that do not allow to retrieve the payment method details. Once passed, it will create payment method at Chargebee with the provided attributes in payment_method_token, customer_profile_token, network_transaction_id, mandate_id, card, and billing_address.

Note:

Currently, the skip_retrieval value as true is only supported for the Vantiv payment gateway.

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.
      • document: Document ID is the user’s identification number based on their country.
  • bluesnap: While passing raw card details to BlueSnap, if fraud_session_id is added, additional validation is performed to avoid fraudulent transactions.
    • fraud: Fraud identification related information.
  • 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.
  • bank_of_america: While passing raw card details to Bank of America, your 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.
  • ecentric: This parameter is used to verify and process payment method details in Ecentric. If the merchant_id parameter is included, Chargebee will vault it / perform a lookup and verification against this merchant_id, overriding the one configured in Chargebee. If tokens and processing occur in the same Merchant GUID, you can just skip this part.
    • merchant_id: Merchant GUID where the card is vaulted or need to be vaulted.
  • ebanx: While passing raw card details to EBANX, the user's document is required for some countries and device_session_id can be added to perform additional validation and avoid fraudulent transactions.
    • payer: User related information.
      • document: Document is the user's identification number based on their country.
    • fraud: Fraud identification related information.
      • device_session_id: Session ID associated with the user's device
.
card[last4]
optional, string, min chars=4, max chars=4
Last four digits of the card number
card[iin]
optional, string, min chars=6, max chars=6
The Issuer Identification Number, i.e. the first six digits of the card number
card[expiry_month]
optional, integer, min=1, max=12
Card expiry month.
card[expiry_year]
optional, integer
Card expiry year.
card[brand]
optional, enumerated string
Card brand
Possible values are
visaA Visa card.mastercardA MasterCard.american_expressAn American Express card.discoverA Discover card.jcbA JCB card.diners_clubA Diner's Club card.otherCard belonging to types other than those listed above.bancontactA Bancontact card.cmr_falabellaA CMR Falabella card.tarjeta_naranjaA Tarjeta Naranja card.nativaA Nativa card.cencosudA Cencosud card.cabalA Cabal card.argencardAn Argencard.eloA Elo card.hipercardAn Hipercard.carnetA Carnet card.rupayA Rupay card.maestroA Maestro card.dankortA Dankort card.cartes_bancairesA Cartes Bancaires card.
visaA Visa card.mastercardA MasterCard.american_expressAn American Express card.discoverA Discover card.
jcbA JCB card.diners_clubA Diner's Club card.otherCard belonging to types other than those listed above.bancontactA Bancontact card.cmr_falabellaA CMR Falabella card.tarjeta_naranjaA Tarjeta Naranja card.nativaA Nativa card.cencosudA Cencosud card.cabalA Cabal card.argencardAn Argencard.eloA Elo card.hipercardAn Hipercard.carnetA Carnet card.rupayA Rupay card.maestroA Maestro card.dankortA Dankort card.cartes_bancairesA Cartes Bancaires card.
Show all values[+]
card[funding_type]
optional, enumerated string
Card Funding type
Possible values are
creditA credit card.debitA debit card.prepaidA prepaid card.not_knownAn unknown card.
creditA credit card.debitA debit card.prepaidA prepaid card.not_knownAn unknown card.
Show all values[+]
billing_address[first_name]
optional, string, max chars=150
The first name of the billing contact.
billing_address[last_name]
optional, string, max chars=150
The last name of the billing contact.
billing_address[email]
optional, string, max chars=70
The email address.
billing_address[line1]
optional, string, max chars=150
Address line 1
billing_address[line2]
optional, string, max chars=150
Address line 2
billing_address[line3]
optional, string, max chars=150
Address line 3
billing_address[city]
optional, string, max chars=50
The name of the city.
billing_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).
billing_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.
billing_address[zip]
optional, string, max chars=20
Zip or postal code. The number of characters is validated according to the rules specified here.
billing_address[country]
optional, string, max chars=50
The billing address country of the customer. Must be one of ISO 3166 alpha-2 country code.

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.

customer customer
always returned
Resource object representing customer
payment_source payment_source
always returned
Resource object representing payment_source

Sample admin console URL

https://{site}.chargebee.com/admin-console/payment_sources/123x
Storing card after successful 3DS completion is not supported in this API. Use create using Payment Intent API under Payment source to store the card after successful 3DS flow completion.

Notes

Sample Request
curl  https://{site}.chargebee.com/api/v2/payment_sources/create_using_token \
     -u {site_api_key}:\
     -d customer_id="__test__XpbTXGTSRp4REKES" \
     -d token_id="cb_tok___test__XpbTXGTSRp4RaBEV"
copy
Click to Copy
curl  https://{site}.chargebee.com/api/v2/payment_sources/create_using_token \
     -u {site_api_key}:\
     -d customer_id="__test__XpbTXGTSRp4REKES" \
     -d token_id="cb_tok___test__XpbTXGTSRp4RaBEV"

Sample Response [ JSON ]

Show more...
{
    "customer": {
        "allow_direct_debit": false,
        "auto_collection": "on",
        "card_status": "valid",
        "created_at": 1517487233,
        "deleted": false,
        "excess_payments": 0,
        "first_name": "Mark",
        "id": "__test__XpbTXGTSRp4REKES",
        "last_name": "Henry",
        "net_term_days": 0,
        "object": "customer",
        "payment_method": {
            "gateway": "stripe",
            "gateway_account_id": "gw___test__5SK2lMpwSRp4Mx02v",
            "object": "payment_method",
            "reference_id": "cus_J7rVlNvtSznu6p/card_1IVbmYJv9j0DyntJOIWtQCkk",
            "status": "valid",
            "type": "card"
        },
        "pii_cleared": "active",
        "preferred_currency_code": "USD",
        "primary_payment_source_id": "pm___test__XpbTXGTSRp4RqgEX",
        "promotional_credits": 0,
        "refundable_credits": 0,
        "resource_version": 1517487236333,
        "taxability": "taxable",
        "unbilled_charges": 0,
        "updated_at": 1517487236
    },
    "payment_source": {
        "card": {
            "brand": "visa",
            "expiry_month": 5,
            "expiry_year": 2022,
            "first_name": "MyCard",
            "funding_type": "credit",
            "iin": "******",
            "last4": "4242",
            "last_name": "testing",
            "masked_number": "************4242",
            "object": "card"
        },
        "created_at": 1517487236,
        "customer_id": "__test__XpbTXGTSRp4REKES",
        "deleted": false,
        "gateway": "stripe",
        "gateway_account_id": "gw___test__5SK2lMpwSRp4Mx02v",
        "id": "pm___test__XpbTXGTSRp4RqgEX",
        "issuing_country": "US",
        "object": "payment_source",
        "reference_id": "cus_J7rVlNvtSznu6p/card_1IVbmYJv9j0DyntJOIWtQCkk",
        "resource_version": 1517487236331,
        "status": "valid",
        "type": "card",
        "updated_at": 1517487236
    }
}

URL Format POST

https://{site}.chargebee.com/api/v2/payment_sources/create_using_token

Method

customer_id[]
required, string, max chars=50
Identifier of the customer with whom this payment source is associated.
replace_primary_payment_source[]
optional, boolean, default=false
Indicates whether the primary payment source should be replaced with this payment source. In case of Create Subscription for Customer endpoint, the default value is True. Otherwise, the default value is False.
token_id[]
required, string, max chars=40
Token generated by Chargebee JS representing payment method details.
customer customer
always returned
Resource object representing customer
payment_source payment_source
always returned
Resource object representing payment_source

Sample admin console URL

https://{site}.chargebee.com/admin-console/payment_sources/123x
Used to attach the card to the customer after 3DS completion. Learn more on the 3DS implementation via Chargebee APIs.

Notes

Sample Request
curl  https://{site}.chargebee.com/api/v2/payment_sources/create_using_payment_intent \
     -u {site_api_key}:\
     -d customer_id="__test__XpbTXGTSRp4MunE0" \
     -d "payment_intent[gateway_account_id]"="gw___test__5SK2lMpwSRp4Mx02v" \
     -d "payment_intent[gw_token]"="pi_1IVbmIJv9j0DyntJo1AUvK4o" 
copy
Click to Copy
curl  https://{site}.chargebee.com/api/v2/payment_sources/create_using_payment_intent \
     -u {site_api_key}:\
     -d customer_id="__test__XpbTXGTSRp4MunE0" \
     -d "payment_intent[gateway_account_id]"="gw___test__5SK2lMpwSRp4Mx02v" \
     -d "payment_intent[gw_token]"="pi_1IVbmIJv9j0DyntJo1AUvK4o" 

Sample Response [ JSON ]

Show more...
{
    "customer": {
        "allow_direct_debit": false,
        "auto_collection": "on",
        "card_status": "valid",
        "created_at": 1517487217,
        "deleted": false,
        "excess_payments": 0,
        "first_name": "Mark",
        "id": "__test__XpbTXGTSRp4MunE0",
        "last_name": "Henry",
        "net_term_days": 0,
        "object": "customer",
        "payment_method": {
            "gateway": "stripe",
            "gateway_account_id": "gw___test__5SK2lMpwSRp4Mx02v",
            "object": "payment_method",
            "reference_id": "cus_J7rVjoqwlD18Ei/pm_1IVbmIJv9j0DyntJCh6glSQB",
            "status": "valid",
            "type": "card"
        },
        "pii_cleared": "active",
        "preferred_currency_code": "USD",
        "primary_payment_source_id": "pm___test__XpbTXGTSRp4Q00E4",
        "promotional_credits": 0,
        "refundable_credits": 0,
        "resource_version": 1517487229215,
        "taxability": "taxable",
        "unbilled_charges": 0,
        "updated_at": 1517487229
    },
    "payment_source": {
        "card": {
            "brand": "visa",
            "expiry_month": 7,
            "expiry_year": 2050,
            "funding_type": "credit",
            "iin": "******",
            "last4": "3055",
            "masked_number": "************3055",
            "object": "card"
        },
        "created_at": 1517487229,
        "customer_id": "__test__XpbTXGTSRp4MunE0",
        "deleted": false,
        "gateway": "stripe",
        "gateway_account_id": "gw___test__5SK2lMpwSRp4Mx02v",
        "id": "pm___test__XpbTXGTSRp4Q00E4",
        "issuing_country": "US",
        "object": "payment_source",
        "reference_id": "cus_J7rVjoqwlD18Ei/pm_1IVbmIJv9j0DyntJCh6glSQB",
        "resource_version": 1517487229213,
        "status": "valid",
        "type": "card",
        "updated_at": 1517487229
    }
}

URL Format POST

https://{site}.chargebee.com/api/v2/payment_sources/create_using_payment_intent

Method

customer_id[]
required, string, max chars=50
Identifier of the customer with whom this payment source is associated.
replace_primary_payment_source[]
optional, boolean, default=false
Indicates whether the primary payment source should be replaced with this payment source. In case of Create Subscription for Customer endpoint, the default value is True. Otherwise, the default value is False.
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]
optional, string, max chars=50
The gateway account used for performing the 3DS flow. Applicable when you are using gateway APIs directly for completing 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.
Possible values are
cardcardidealidealsofortsofortbancontactbancontactgoogle_paygoogle_paydotpaydotpaygiropaygiropayapple_payapple_payupiupinetbanking_emandatesnetbanking_emandatespaypal_express_checkoutpaypal_express_checkoutdirect_debitdirect_debitboletoboletovenmoVenmo amazon_paymentsAmazon Paymentspay_toPayTo faster_paymentsFaster Payments sepa_instant_transferSepa Instant Transfer klarna_pay_nowKlarna Pay Now online_banking_poland
cardcardidealidealsofortsofortbancontactbancontact
google_paygoogle_paydotpaydotpaygiropaygiropayapple_payapple_payupiupinetbanking_emandatesnetbanking_emandatespaypal_express_checkoutpaypal_express_checkoutdirect_debitdirect_debitboletoboletovenmoVenmo amazon_paymentsAmazon Paymentspay_toPayTo faster_paymentsFaster Payments sepa_instant_transferSepa Instant Transfer klarna_pay_nowKlarna Pay Now online_banking_poland
Show all values[+]
payment_intent[reference_id]
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_info]
optional, jsonobject
Applicable only for Braintree gateway. Can be used only for Braintree’s Premium Fraud Management Tools. Pass a stringified JSON containing the device_session_id and fraud_merchant_id as an input to fingerprint. Here’s a sample to it.
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.
      • document: Document ID is the user’s identification number based on their country.
  • bluesnap: While passing raw card details to BlueSnap, if fraud_session_id is added, additional validation is performed to avoid fraudulent transactions.
    • fraud: Fraud identification related information.
  • 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.
  • bank_of_america: While passing raw card details to Bank of America, your 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.
  • ecentric: This parameter is used to verify and process payment method details in Ecentric. If the merchant_id parameter is included, Chargebee will vault it / perform a lookup and verification against this merchant_id, overriding the one configured in Chargebee. If tokens and processing occur in the same Merchant GUID, you can just skip this part.
    • merchant_id: Merchant GUID where the card is vaulted or need to be vaulted.
  • ebanx: While passing raw card details to EBANX, the user's document is required for some countries and device_session_id can be added to perform additional validation and avoid fraudulent transactions.
    • payer: User related information.
      • document: Document is the user's identification number based on their country.
    • fraud: Fraud identification related information.
      • device_session_id: Session ID associated with the user's device
customer customer
always returned
Resource object representing customer
payment_source payment_source
always returned
Resource object representing payment_source

Sample admin console URL

https://{site}.chargebee.com/admin-console/payment_sources/123x
Create a voucher payment method for the payment source.

Notes

Sample Request
curl  https://{site}.chargebee.com/api/v2/payment_sources/create_voucher_payment_source \
     -u {site_api_key}:\
     -d customer_id="__test__XpbTXGTSRp4Mg0Dr" \
     -d "voucher_payment_source[voucher_type]"="BOLETO" \
     -d "voucher_payment_source[tax_id]"="00000000000000" \
     -d "voucher_payment_source[gateway_account_id]"="gw_161my9TXG5oNYwgv" \
     -d "voucher_payment_source[billing_address]"='{"first_name":"John","last_name":"Doe","line1":"No 4 metro street","line2":"rio","country_code":"br","state_code":"ap","city":"rio","postal_code":"20080003","email":"johndoe@example.com"}' 
copy
Click to Copy
curl  https://{site}.chargebee.com/api/v2/payment_sources/create_voucher_payment_source \
     -u {site_api_key}:\
     -d customer_id="__test__XpbTXGTSRp4Mg0Dr" \
     -d "voucher_payment_source[voucher_type]"="BOLETO" \
     -d "voucher_payment_source[tax_id]"="00000000000000" \
     -d "voucher_payment_source[gateway_account_id]"="gw_161my9TXG5oNYwgv" \
     -d "voucher_payment_source[billing_address]"='{"first_name":"John","last_name":"Doe","line1":"No 4 metro street","line2":"rio","country_code":"br","state_code":"ap","city":"rio","postal_code":"20080003","email":"johndoe@example.com"}' 

Sample Response [ JSON ]

Show more...
{
    "payment_source": {
        "id": "pm_HmhZXuiTcB6bEh1K9s",
        "updated_at": 1682183992,
        "resource_version": 1682183992360,
        "deleted": false,
        "object": "payment_source",
        "customer_id": "__test__XpbTXGTSRp4Mg0Dr",
        "type": "boleto",
        "reference_id": "cus_NlGdeYYqRj9ca9/pm_1Mzk6GK7ilSfRo7vhZxk82n8",
        "status": "valid",
        "gateway": "stripe",
        "gateway_account_id": "gw_161my9TXG5oNYwgv",
        "created_at": 1682183992,
        "boleto": {
            "last4": "0000",
            "first_name": "John",
            "last_name": "Doe",
            "email": "johndoe@example.com",
            "object": "cust_voucher_source"
        },
        "billing_address": {
            "line1": "No 4 metro street",
            "line2": "rio street",
            "city": "rio",
            "state_code": "ap",
            "validation_status": "not_validated",
            "object": "billing_address"
        },
        "business_entity_id": "org1"
    },
    "customer": {
        "id": "__test__XpbTXGTSRp4Mg0Dr",
        "first_name": "John",
        "last_name": "Doe",
        "email": "johndoe2@example.com",
        "auto_collection": "off",
        "offline_payment_method": "no_preference",
        "net_term_days": 0,
        "allow_direct_debit": false,
        "created_at": 1682180803,
        "taxability": "taxable",
        "updated_at": 1682183992,
        "pii_cleared": "active",
        "channel": "web",
        "resource_version": 1682183992357,
        "deleted": false,
        "object": "customer",
        "card_status": "no_card",
        "promotional_credits": 0,
        "refundable_credits": 0,
        "excess_payments": 0,
        "unbilled_charges": 0,
        "preferred_currency_code": "BRL",
        "business_entity_id": "org1"
    }
}

URL Format POST

https://{site}.chargebee.com/api/v2/payment_sources/create_voucher_payment_source

Method

customer_id[]
required, string, max chars=50
Identifier of the customer with whom this payment source is associated.
voucher_payment_source[voucher_type]
required, enumerated string
Voucher based payment methods
Possible values are
boletoBoleto
boletoBoleto
Show all values[+]
voucher_payment_source[gateway_account_id]
optional, string, max chars=50
The gateway account to which the payment method is associated.
voucher_payment_source[tax_id]
optional, string, max chars=20
Customer Tax id
voucher_payment_source[billing_address]
optional, jsonobject
The billing address of the customer. The value is a JSON object with the following keys and their values:
  • first_name:(string, max chars=150) The first name of the contact.
  • last_name:(string, max chars=150) The last name of the contact.
  • line1:(string, max chars=180) The first line of the address.
  • line2:(string, max chars=180) The second line of the address.
  • country_code:(string, max chars=50) The two-letter, ISO 3166 alpha-2 country code for the address.
  • state_code:(string, max chars=50) The ISO 3166-2 state/province code without the country prefix.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).
  • city:(string, max chars=50) The city name for the address.
  • postal_code:(string, max chars=20) The postal or ZIP code for the address.
  • phone:(string, max chars=50) The contact phone number for the address.
  • email:(string, max chars=70) The contact email address for the address.
customer customer
always returned
Resource object representing customer
payment_source payment_source
always returned
Resource object representing payment_source

Sample admin console URL

https://{site}.chargebee.com/admin-console/payment_sources/123x
Storing card after successful 3DS completion is not supported in this API. Use create using Payment Intent API under Payment source to store the card after successful 3DS flow completion.

Notes

Sample Request
curl  https://{site}.chargebee.com/api/v2/payment_sources/create_card \
     -u {site_api_key}:\
     -d customer_id="__test__XpbTXGTSRp4Mg0Dr" \
     -d "card[number]"="378282246310005" \
     -d "card[cvv]"="100" \
     -d "card[expiry_year]"=2022 \
     -d "card[expiry_month]"=12 
copy
Click to Copy
curl  https://{site}.chargebee.com/api/v2/payment_sources/create_card \
     -u {site_api_key}:\
     -d customer_id="__test__XpbTXGTSRp4Mg0Dr" \
     -d "card[number]"="378282246310005" \
     -d "card[cvv]"="100" \
     -d "card[expiry_year]"=2022 \
     -d "card[expiry_month]"=12 

Sample Response [ JSON ]

Show more...
{
    "customer": {
        "allow_direct_debit": false,
        "auto_collection": "on",
        "card_status": "valid",
        "created_at": 1517487216,
        "deleted": false,
        "excess_payments": 0,
        "first_name": "Mark",
        "id": "__test__XpbTXGTSRp4Mg0Dr",
        "last_name": "Henry",
        "net_term_days": 0,
        "object": "customer",
        "payment_method": {
            "gateway": "chargebee",
            "gateway_account_id": "gw___test__5SK2lMpwSRp4LJJ1y",
            "object": "payment_method",
            "reference_id": "tok___test__XpbTXGTSRp4MkpDu",
            "status": "valid",
            "type": "card"
        },
        "pii_cleared": "active",
        "preferred_currency_code": "USD",
        "primary_payment_source_id": "pm___test__XpbTXGTSRp4Ml3Dv",
        "promotional_credits": 0,
        "refundable_credits": 0,
        "resource_version": 1517487216760,
        "taxability": "taxable",
        "unbilled_charges": 0,
        "updated_at": 1517487216
    },
    "payment_source": {
        "card": {
            "brand": "american_express",
            "expiry_month": 12,
            "expiry_year": 2022,
            "funding_type": "not_known",
            "iin": "378282",
            "last4": "0005",
            "masked_number": "***********0005",
            "object": "card"
        },
        "created_at": 1517487216,
        "customer_id": "__test__XpbTXGTSRp4Mg0Dr",
        "deleted": false,
        "gateway": "chargebee",
        "gateway_account_id": "gw___test__5SK2lMpwSRp4LJJ1y",
        "id": "pm___test__XpbTXGTSRp4Ml3Dv",
        "object": "payment_source",
        "reference_id": "tok___test__XpbTXGTSRp4MkpDu",
        "resource_version": 1517487216756,
        "status": "valid",
        "type": "card",
        "updated_at": 1517487216
    }
}

URL Format POST

https://{site}.chargebee.com/api/v2/payment_sources/create_card

Method

customer_id[]
required, string, max chars=50
Identifier of the customer with whom this payment source is associated.
replace_primary_payment_source[]
optional, boolean, default=false
Indicates whether the primary payment source should be replaced with this payment source. In case of Create Subscription for Customer endpoint, the default value is True. Otherwise, the default value is False.
card[gateway_account_id]
optional, string, max chars=50
The gateway account in which this payment source is stored.
card[first_name]
optional, string, max chars=50
Cardholder's first name
card[last_name]
optional, string, max chars=50
Cardholder's last name
card[number]
required, string, max chars=1500
The credit card number without any format. If you are using Braintree.js, you can specify the Braintree encrypted card number here.
card[expiry_month]
required, integer, min=1, max=12
Card expiry month.
card[expiry_year]
required, integer
Card expiry year.
card[cvv]
optional, string, max chars=520
The card verification value (CVV). If you are using Braintree.js, you can specify the Braintree encrypted CVV here.
card[preferred_scheme]
optional, enumerated string
The customer's preferred card scheme for co-branded cards.
Note: Currently, this parameter is only supported for Stripe.
Possible values are
cartes_bancairesA Cartes Bancaires card scheme.mastercardA MasterCard scheme.visaA Visa card scheme.
cartes_bancairesA Cartes Bancaires card scheme.mastercardA MasterCard scheme.visaA Visa card scheme.
Show all values[+]
card[billing_addr1]
optional, string, max chars=150
Address line 1, as available in card billing address.
card[billing_addr2]
optional, string, max chars=150
Address line 2, as available in card billing address.
card[billing_city]
optional, string, max chars=50
City, as available in card billing address.
card[billing_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).
card[billing_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.
card[billing_zip]
optional, string, max chars=20
Postal or Zip code, as available in card billing address.
card[billing_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.

card[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.
      • document: Document ID is the user’s identification number based on their country.
  • bluesnap: While passing raw card details to BlueSnap, if fraud_session_id is added, additional validation is performed to avoid fraudulent transactions.
    • fraud: Fraud identification related information.
  • 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.
  • bank_of_america: While passing raw card details to Bank of America, your 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.
  • ecentric: This parameter is used to verify and process payment method details in Ecentric. If the merchant_id parameter is included, Chargebee will vault it / perform a lookup and verification against this merchant_id, overriding the one configured in Chargebee. If tokens and processing occur in the same Merchant GUID, you can just skip this part.
    • merchant_id: Merchant GUID where the card is vaulted or need to be vaulted.
  • ebanx: While passing raw card details to EBANX, the user's document is required for some countries and device_session_id can be added to perform additional validation and avoid fraudulent transactions.
    • payer: User related information.
      • document: Document is the user's identification number based on their country.
    • fraud: Fraud identification related information.
      • device_session_id: Session ID associated with the user's device
customer customer
always returned
Resource object representing customer
payment_source payment_source
always returned
Resource object representing payment_source

Sample admin console URL

https://{site}.chargebee.com/admin-console/payment_sources/123x

This API adds a Direct Debit payment source for a customer. The bank account details collected from your customer are passed as input to this API.

Automated Clearing House (ACH) Network

ACH is an electronic network for passing financial transactions in the US. Chargebee currently supports ACH via Stripe , Authorize.Net, and GoCardless.

Note:
  • For ACH via Stripe, it is mandatory to pass user details such as IP address(chargebee-request-origin-ip) and the device information(chargebee-request-origin-device).
Bank account verification

Once the bank account has been added, it needs to be verified.

Single Euro Payment Area (SEPA)

SEPA is an initiative that integrates bank transfer payments denominated in euro. It is supported via GoCardless, Stripe and Adyen.

Note:
  • For SEPA via Stripe, it is mandatory to pass user details such as IP address and device information.
  • For GoCardless, local bank details can be passed instead of IBAN.

Bacs Payment Schemes Limited (BACS) and Bg Autogiro

Bacs is an organization that manages the Direct Debit and Direct Credit payment methods in the UK. Bg Autogiro is a Direct Debit scheme for krona denominated payments in Sweden. Both Bacs and Bg Autogiro are supported via GoCardless.

Note:
  • For BACS via Stripe, it is mandatory to pass user details such as IP address(chargebee-request-origin-ip) and the device information(chargebee-request-origin-device).

Bulk Electronic Clearing System (BECS) and Pre-Authorized Debit (PAD)

BECS is an automated payment method for Direct Debit in Australia and New Zealand while PAD does the same for Canada. GoCardless supports both.

For Direct Debit, the customer needs to accept a mandate that allows the merchant to debit their bank account. This agreement PDF can be obtained using the Retrieve direct debit agreement PDF API.

If the customer has already reached the payment source limit allowed for the site, pass replace_primary_payment_source as true. Alternatively, delete one of the payment sources first and then add the bank account payment source for the customer.

Note:
  • For BECS via Stripe, it is mandatory to pass user details such as IP address(chargebee-request-origin-ip) and the device information(chargebee-request-origin-device).

Notes

Sample Request
curl  https://{site}.chargebee.com/api/v2/payment_sources/create_bank_account \
     -u {site_api_key}:\
     -d customer_id="__test__XpbTXGTSRp4Ly9Dj" \
     -d "bank_account[gateway_account_id]"="gw___test__5SK2lMpwSRp4Ljs2t" \
     -d "bank_account[account_number]"="000222222227" \
     -d "bank_account[routing_number]"="110000000" \
     -d "bank_account[bank_name]"="US Bank" \
     -d "bank_account[account_holder_type]"="INDIVIDUAL" \
     -d "bank_account[account_type]"="SAVINGS" \
     -d "bank_account[first_name]"="Shay" \
     -d "bank_account[last_name]"="Liam" 
copy
Click to Copy
curl  https://{site}.chargebee.com/api/v2/payment_sources/create_bank_account \
     -u {site_api_key}:\
     -d customer_id="__test__XpbTXGTSRp4Ly9Dj" \
     -d "bank_account[gateway_account_id]"="gw___test__5SK2lMpwSRp4Ljs2t" \
     -d "bank_account[account_number]"="000222222227" \
     -d "bank_account[routing_number]"="110000000" \
     -d "bank_account[bank_name]"="US Bank" \
     -d "bank_account[account_holder_type]"="INDIVIDUAL" \
     -d "bank_account[account_type]"="SAVINGS" \
     -d "bank_account[first_name]"="Shay" \
     -d "bank_account[last_name]"="Liam" 

Sample Response [ JSON ]

Show more...
{
    "customer": {
        "allow_direct_debit": true,
        "auto_collection": "on",
        "created_at": 1517487213,
        "deleted": false,
        "excess_payments": 0,
        "first_name": "Mark",
        "id": "__test__XpbTXGTSRp4Ly9Dj",
        "last_name": "Henry",
        "net_term_days": 0,
        "object": "customer",
        "payment_method": {
            "gateway": "stripe",
            "gateway_account_id": "gw___test__5SK2lMpwSRp4Ljs2t",
            "object": "payment_method",
            "reference_id": "cus_J7rVKldNI2hKt0/ba_1IVbmEJv9j0DyntJTe5oRPZE",
            "status": "pending_verification",
            "type": "direct_debit"
        },
        "pii_cleared": "active",
        "preferred_currency_code": "USD",
        "primary_payment_source_id": "pm___test__XpbTXGTSRp4MS7Dm",
        "promotional_credits": 0,
        "refundable_credits": 0,
        "resource_version": 1517487215586,
        "taxability": "taxable",
        "unbilled_charges": 0,
        "updated_at": 1517487215
    },
    "payment_source": {
        "bank_account": {
            "account_holder_type": "individual",
            "account_type": "not_applicable",
            "bank_name": "US Bank",
            "last4": "2227",
            "name_on_account": "Shay Liam",
            "object": "bank_account"
        },
        "created_at": 1517487215,
        "customer_id": "__test__XpbTXGTSRp4Ly9Dj",
        "deleted": false,
        "gateway": "stripe",
        "gateway_account_id": "gw___test__5SK2lMpwSRp4Ljs2t",
        "id": "pm___test__XpbTXGTSRp4MS7Dm",
        "issuing_country": "US",
        "object": "payment_source",
        "reference_id": "cus_J7rVKldNI2hKt0/ba_1IVbmEJv9j0DyntJTe5oRPZE",
        "resource_version": 1517487215582,
        "status": "pending_verification",
        "type": "direct_debit",
        "updated_at": 1517487215
    }
}

URL Format POST

https://{site}.chargebee.com/api/v2/payment_sources/create_bank_account

Method

customer_id[]
required, string, max chars=50
Identifier of the customer with whom this payment source is associated.
issuing_country[]
optional, string, max chars=50
2-letter(alpha2) ISO country code. Required when local bank details are provided, and not IBAN.
replace_primary_payment_source[]
optional, boolean, default=false
Indicates whether the primary payment source should be replaced with this payment source. In case of Create Subscription for Customer endpoint, the default value is True. Otherwise, the default value is False.
bank_account[gateway_account_id]
optional, string, max chars=50
The gateway account in which this payment source is stored.
bank_account[iban]
optional, string, min chars=10, max chars=50
Account holder’s International Bank Account Number. For the GoCardless platform, this can be the local bank details
bank_account[first_name]
optional, string, max chars=150
Account holder’s first name as per bank account. If not passed, details from customer details will be considered.
bank_account[last_name]
optional, string, max chars=150
Account holder’s last name as per bank account. If not passed, details from customer details will be considered.
bank_account[company]
optional, string, max chars=250
Account holder’s company name as per bank account. If not passed, details from customer details will be considered.
bank_account[email]
optional, string, max chars=70
Account holder’s email address. If not passed, details from customer details will be considered. All Direct Debit compliant emails will be sent to this email address.
bank_account[phone]
optional, string, max chars=50
Phone number of the account holder that is linked to the bank account.
bank_account[bank_name]
optional, string, max chars=100
Name of account holder’s bank.
bank_account[account_number]
optional, string, min chars=4, max chars=17
Account holder’s bank account number.
bank_account[routing_number]
optional, string, min chars=3, max chars=9
Bank account routing number.
bank_account[bank_code]
optional, string, max chars=20
Indicates the bank code.
bank_account[account_type]
optional, enumerated string
Represents the account type used to create a payment source. Available for Authorize.net ACH and Razorpay NetBanking users only. If not passed, account type is taken as null.
Possible values are
checkingChecking AccountsavingsSavings Accountbusiness_checkingBusiness Checking AccountcurrentCurrent Account
checkingChecking AccountsavingsSavings Accountbusiness_checkingBusiness Checking AccountcurrentCurrent Account
Show all values[+]
bank_account[account_holder_type]
optional, enumerated string
For Stripe ACH users only. Indicates the account holder type.
Possible values are
individualIndividual Account.companyCompany Account.
individualIndividual Account.companyCompany Account.
Show all values[+]
bank_account[echeck_type]
optional, enumerated string
For Authorize.net ACH users only. Indicates the type of eCheck.
Possible values are
webPayment Authorization obtained from the customer via the internet.ppdPayment Authorization is prearranged between the customer and the merchant.ccdPayment Authorization agreement from the corporate customer is required. Applicable for business_checking account_type.
webPayment Authorization obtained from the customer via the internet.ppdPayment Authorization is prearranged between the customer and the merchant.ccdPayment Authorization agreement from the corporate customer is required. Applicable for business_checking account_type.
Show all values[+]
bank_account[swedish_identity_number]
optional, string, min chars=10, max chars=12
For GoCardless Autogiro users only. The civic/company number (personnummer, samordningsnummer, or organisationsnummer) of the customer. Must be supplied if the customer’s bank account is denominated in Swedish krona (SEK). This field cannot be changed once it has been set.
bank_account[billing_address]
optional, jsonobject
The billing address associated with the bank account. The value is a JSON object with the following keys and their values:
  • first_name:(string, max chars=150) The first name of the contact.
  • last_name:(string, max chars=150) The last name of the contact.
  • company_name:(string, max chars=250) The company name for the address.
  • line1:(string, max chars=180) The first line of the address.
  • line2:(string, max chars=180) The second line of the address.
  • country:(string) The name of the country for the address.
  • country_code:(string, max chars=50) The two-letter, ISO 3166 alpha-2 country code for the address.
  • state:(string, max chars=50) The name of the state or province for the address. When not provided, this is set automatically for US, Canada, and India.
  • state_code:(string, max chars=50) The ISO 3166-2 state/province code without the country prefix. This is 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).
  • city:(string, max chars=50) The city name for the address.
  • postal_code:(string, max chars=20) The postal or ZIP code for the address.
  • phone:(string, max chars=50) The contact phone number for the address.
  • email:(string, max chars=70) The contact email address for the address.
customer customer
always returned
Resource object representing customer
payment_source payment_source
always returned
Resource object representing payment_source

Sample admin console URL

https://{site}.chargebee.com/admin-console/payment_sources/123x
Merchants look to update card details when:
  • The billing address of a customer has changed. In such a case, modify the billing address in the Chargebee and the payment gateway.
  • The expiration date of the card has been extended by the bank. (This usually happens when the date of card expiry is in near future).

Multiple parameters such as address, expiry date, month, and so on, can be updated through this API.

Meta data can also be added additionally(supported in Stripe only). Metadata is a JSON object. It is used to store additional information about customers.

In Stripe and Braintree payment gateways, changes in card details are auto-updated. This feature can also be used for other payment gateways in which auto-update is not enabled or is not supported by Chargebee.

Note: This endpoint supports Chargebee Test Gateway, Stripe, Braintree, Authorize.net, Worldpay US eCom, and WorldPay Direct Integration. For all other gateways, your customers must re-enter the full card details to update existing card details. For example, consider a customer not using the gateways mentioned above and wants to update the card[billing_addr1] parameter. In such a case, the customer must re-enter the value of all the parameters present in the card object.

Notes

Sample Request
curl  https://{site}.chargebee.com/api/v2/payment_sources/pm___test__XpbTXGTSRp4Xy9FR/update_card \
     -u {site_api_key}:\
     -d "card[first_name]"="John" \
     -d "card[last_name]"="Doe" \
     -d "card[expiry_month]"=5 \
     -d "card[expiry_year]"=2022 \
     -d "card[billing_addr1]"="#678 Mission Street" \
     -d "card[billing_city]"="New York City" \
     -d "card[billing_zip]"="10002" \
     -d "card[billing_state_code]"="NY" \
     -d "card[billing_country]"="US" 
copy
Click to Copy
curl  https://{site}.chargebee.com/api/v2/payment_sources/pm___test__XpbTXGTSRp4Xy9FR/update_card \
     -u {site_api_key}:\
     -d "card[first_name]"="John" \
     -d "card[last_name]"="Doe" \
     -d "card[expiry_month]"=5 \
     -d "card[expiry_year]"=2022 \
     -d "card[billing_addr1]"="#678 Mission Street" \
     -d "card[billing_city]"="New York City" \
     -d "card[billing_zip]"="10002" \
     -d "card[billing_state_code]"="NY" \
     -d "card[billing_country]"="US" 

Sample Response [ JSON ]

Show more...
{
    "customer": {
        "allow_direct_debit": false,
        "auto_collection": "on",
        "card_status": "valid",
        "created_at": 1517487258,
        "deleted": false,
        "excess_payments": 0,
        "first_name": "Mark",
        "id": "__test__XpbTXGTSRp4Xi1FQ",
        "last_name": "Henry",
        "net_term_days": 0,
        "object": "customer",
        "payment_method": {
            "gateway": "stripe",
            "gateway_account_id": "gw___test__5SK2lMpwSRp4Mx02v",
            "object": "payment_method",
            "reference_id": "cus_J7rVemdQKHVECd/card_1IVbmxJv9j0DyntJlQ8osjf2",
            "status": "valid",
            "type": "card"
        },
        "pii_cleared": "active",
        "preferred_currency_code": "USD",
        "primary_payment_source_id": "pm___test__XpbTXGTSRp4Xy9FR",
        "promotional_credits": 0,
        "refundable_credits": 0,
        "resource_version": 1517487261178,
        "taxability": "taxable",
        "unbilled_charges": 0,
        "updated_at": 1517487261
    },
    "payment_source": {
        "card": {
            "billing_addr1": "#678 Mission Street",
            "billing_city": "New York City",
            "billing_country": "US",
            "billing_zip": "10002",
            "brand": "visa",
            "expiry_month": 5,
            "expiry_year": 2022,
            "first_name": "John",
            "funding_type": "credit",
            "iin": "******",
            "last4": "1111",
            "last_name": "Doe",
            "masked_number": "************1111",
            "object": "card"
        },
        "created_at": 1517487259,
        "customer_id": "__test__XpbTXGTSRp4Xi1FQ",
        "deleted": false,
        "gateway": "stripe",
        "gateway_account_id": "gw___test__5SK2lMpwSRp4Mx02v",
        "id": "pm___test__XpbTXGTSRp4Xy9FR",
        "issuing_country": "US",
        "object": "payment_source",
        "reference_id": "cus_J7rVemdQKHVECd/card_1IVbmxJv9j0DyntJlQ8osjf2",
        "resource_version": 1517487261179,
        "status": "valid",
        "type": "card",
        "updated_at": 1517487261
    }
}

URL Format POST

https://{site}.chargebee.com/api/v2/payment_sources/{cust-payment-source-id}/update_card

Method

gateway_meta_data[]
optional, jsonobject
Additional data about this resource can be passed to Stripe gateway here in the JSON Format. This will be stored along with payment source at the gateway account.
reference_transaction[]
optional, string, max chars=50
Reference transaction is used for future purchases. This is only applicable for Vantiv.
card[first_name]
optional, string, max chars=50
Cardholder's first name
card[last_name]
optional, string, max chars=50
Cardholder's last name
card[expiry_month]
optional, integer, min=1, max=12
Card expiry month.
card[expiry_year]
optional, integer
Card expiry year.
card[billing_addr1]
optional, string, max chars=150
Address line 1, as available in card billing address.
card[billing_addr2]
optional, string, max chars=150
Address line 2, as available in card billing address.
card[billing_city]
optional, string, max chars=50
City, as available in card billing address.
card[billing_zip]
optional, string, max chars=20
Postal or Zip code, as available in card billing address.
card[billing_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).
card[billing_state]
optional, string, max chars=50
The state/province name.
card[billing_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.

card[additional_information]
optional, jsonobject
  • ebanx: While passing raw card details to EBANX, the user's document is required for some countries.
    • payer: User related information.
      • document: Document is the user's identification number based on their country.
customer customer
always returned
Resource object representing customer
payment_source payment_source
always returned
Resource object representing payment_source

Sample admin console URL

https://{site}.chargebee.com/admin-console/payment_sources/123x
This API is used to update the payment source details of a customer. Information related to bank account payment source such as email, first name, and last name can be updated.

  • For GoCardless, Chargebee supports (ACH,BACS,SEPA,AUTOGIRO,BECS,BECS_NZ,PAD).
  • For Stripe, Chargebee only supports SEPA.

Notes

The API is only supported for the payment_method of type direct_debit.

Sample Request
curl  https://{site}.chargebee.com/api/v2/payment_sources/pm___test__KyVnPbSerKGB5d/update_bank_account \
     -u {site_api_key}:\
     -d "bank_account[email]"="johndoe@example.com" \
     -d "bank_account[first_name]"="John" \
     -d "bank_account[last_name]"="Doe" 
copy
Click to Copy
curl  https://{site}.chargebee.com/api/v2/payment_sources/pm___test__KyVnPbSerKGB5d/update_bank_account \
     -u {site_api_key}:\
     -d "bank_account[email]"="johndoe@example.com" \
     -d "bank_account[first_name]"="John" \
     -d "bank_account[last_name]"="Doe" 

Sample Response [ JSON ]

Show more...
{
    "customer": {
        "allow_direct_debit": true,
        "auto_collection": "on",
        "channel": "web",
        "created_at": 1517507082,
        "deleted": false,
        "email": "markhenry@example.com",
        "excess_payments": 0,
        "first_name": "Mark",
        "id": "__test__KyVnPbSerKFjFY",
        "last_name": "Henry",
        "net_term_days": 0,
        "object": "customer",
        "payment_method": {
            "gateway": "stripe",
            "gateway_account_id": "gw___test__KyVnGoSerKFdA2t",
            "object": "payment_method",
            "reference_id": "cus_Jxe0kGs9uZuKX3/src_1JJiiNJv9j0DyntJXYkqBHE8",
            "status": "valid",
            "type": "direct_debit"
        },
        "pii_cleared": "active",
        "preferred_currency_code": "EUR",
        "primary_payment_source_id": "pm___test__KyVnPbSerKGB5d",
        "promotional_credits": 0,
        "refundable_credits": 0,
        "resource_version": 1517507084711,
        "taxability": "taxable",
        "unbilled_charges": 0,
        "updated_at": 1517507084
    },
    "payment_source": {
        "bank_account": {
            "email": "johndoe@example.com",
            "last4": "3000",
            "mandate_id": "OI1M52OFAXGFQZRR",
            "name_on_account": "John Doe",
            "object": "bank_account"
        },
        "created_at": 1517507084,
        "customer_id": "__test__KyVnPbSerKFjFY",
        "deleted": false,
        "gateway": "stripe",
        "gateway_account_id": "gw___test__KyVnGoSerKFdA2t",
        "id": "pm___test__KyVnPbSerKGB5d",
        "issuing_country": "DE",
        "object": "payment_source",
        "reference_id": "cus_Jxe0kGs9uZuKX3/src_1JJiiNJv9j0DyntJXYkqBHE8",
        "resource_version": 1517507084712,
        "status": "valid",
        "type": "direct_debit",
        "updated_at": 1517507084
    }
}

URL Format POST

https://{site}.chargebee.com/api/v2/payment_sources/{cust-payment-source-id}/update_bank_account

Method

bank_account[first_name]
optional, string, max chars=150
Account holder’s first name as per bank account.
bank_account[last_name]
optional, string, max chars=150
Account holder’s last name as per bank account.
bank_account[email]
optional, string, max chars=70
Account holder’s email address. All Direct Debit compliant emails will be sent to this email address.
customer customer
always returned
Resource object representing customer
payment_source payment_source
always returned
Resource object representing payment_source

Sample admin console URL

https://{site}.chargebee.com/admin-console/payment_sources/123x

This API can be used to verify bank accounts which have been added as payment source. This is applicable for Stripe ACH with micro-deposit mode bank accounts only. Stripe handles verification in two ways - via Plaid, and micro-deposit.

For verifying bank accounts via micro-deposit, Stripe deposits two small amounts to the bank account being added. These deposits will take 1-2 business days to appear on the customer’s bank statement. The bank statement description for the two micro-deposits contains the amount and the values deposited. Your customer will need to relay the value of the two deposits to you, after which you can verify the bank account. Once the bank account has been verified, the payment source will be marked as “Valid”.

Notes

A maximum of 10 failed verification attempts are allowed. Once this limit has been crossed, the bank account can no longer be verified, and will be marked as “Invalid” in Chargebee.

Sample Request
curl  https://{site}.chargebee.com/api/v2/payment_sources/pm___test__XpbTXGTSRp4YjRFc/verify_bank_account \
     -u {site_api_key}:\
     -d amount1=32 \
     -d amount2=45
copy
Click to Copy
curl  https://{site}.chargebee.com/api/v2/payment_sources/pm___test__XpbTXGTSRp4YjRFc/verify_bank_account \
     -u {site_api_key}:\
     -d amount1=32 \
     -d amount2=45

Sample Response [ JSON ]

Show more...
{
    "payment_source": {
        "bank_account": {
            "account_holder_type": "individual",
            "account_type": "not_applicable",
            "bank_name": "US Bank",
            "last4": "2227",
            "name_on_account": "Shay Liam",
            "object": "bank_account"
        },
        "created_at": 1517487262,
        "customer_id": "__test__XpbTXGTSRp4YNIFZ",
        "deleted": false,
        "gateway": "stripe",
        "gateway_account_id": "gw___test__5SK2lMpwSRp4Ljs2t",
        "id": "pm___test__XpbTXGTSRp4YjRFc",
        "issuing_country": "US",
        "object": "payment_source",
        "reference_id": "cus_J7rW1Bl7xQoLOW/ba_1IVbmzJv9j0DyntJXpjNOH1r",
        "resource_version": 1517487263313,
        "status": "valid",
        "type": "direct_debit",
        "updated_at": 1517487263
    }
}

URL Format POST

https://{site}.chargebee.com/api/v2/payment_sources/{cust-payment-source-id}/verify_bank_account

Method

amount1[]
required, in cents, min=0
Value of the micro-deposits sent to the bank account.
amount2[]
required, in cents, min=0
Value of the micro-deposits sent to the bank account.
payment_source payment_source
always returned
Resource object representing payment_source

Sample admin console URL

https://{site}.chargebee.com/admin-console/payment_sources/123x
Retrieves the payment source identified by the unique identifier.

Notes

Sample Request
curl  https://{site}.chargebee.com/api/v2/payment_sources/pm___test__KyVmmpTSneqVht \
     -u {site_api_key}:
copy
Click to Copy
curl  https://{site}.chargebee.com/api/v2/payment_sources/pm___test__KyVmmpTSneqVht \
     -u {site_api_key}:

Sample Response [ JSON ]

Show more...
{
    "payment_source": {
        "card": {
            "brand": "visa",
            "expiry_month": 12,
            "expiry_year": 2030,
            "funding_type": "credit",
            "iin": "411111",
            "last4": "1111",
            "masked_number": "************1111",
            "object": "card"
        },
        "created_at": 1517467526,
        "customer_id": "__test__KyVmmpTSneqFXs",
        "deleted": false,
        "gateway": "stripe",
        "gateway_account_id": "gw___test__KyVmsTTSnefon30",
        "id": "pm___test__KyVmmpTSneqVht",
        "issuing_country": "US",
        "object": "payment_source",
        "reference_id": "cus_NA13opXonQckcW/card_0MPh10J7ubj1SVcrJTe4m32g",
        "resource_version": 1517467526693,
        "status": "valid",
        "type": "card",
        "updated_at": 1517467526
    }
}

URL Format GET

https://{site}.chargebee.com/api/v2/payment_sources/{cust-payment-source-id}

Method

payment_source payment_source
always returned
Resource object representing payment_source

Sample admin console URL

https://{site}.chargebee.com/admin-console/payment_sources/123x
Lists all the payment sources

Notes

Sample Request
curl  https://{site}.chargebee.com/api/v2/payment_sources \
     -G  \
     -u {site_api_key}:\
     --data-urlencode limit=3 \
     --data-urlencode "type[is]"="card"
copy
Click to Copy
curl  https://{site}.chargebee.com/api/v2/payment_sources \
     -G  \
     -u {site_api_key}:\
     --data-urlencode limit=3 \
     --data-urlencode "type[is]"="card"

Sample Response [ JSON ]

Show more...
{
    "list": [
        {
            "payment_source": {
                "card": {
                    "brand": "visa",
                    "expiry_month": 12,
                    "expiry_year": 2022,
                    "first_name": "Richard",
                    "funding_type": "not_known",
                    "iin": "411111",
                    "last4": "1111",
                    "last_name": "Fox",
                    "masked_number": "************1111",
                    "object": "card"
                },
                "created_at": 1517487242,
                "customer_id": "__test__XpbTXGTSRp4SZ5En",
                "deleted": false,
                "gateway": "pin",
                "gateway_account_id": "gw___test__5SK2lMpwSRp4Sb831",
                "id": "pm___test__XpbTXGTSRp4TUQEq",
                "object": "payment_source",
                "reference_id": "LHqS22OIh4y61Af9CXHicQFCfuD",
                "resource_version": 1517487242630,
                "status": "valid",
                "type": "card",
                "updated_at": 1517487242
            }
        },
        {..}
    ],
    "next_offset": "[\"1517487233000\",\"209000000107\"]"
}

URL Format GET

https://{site}.chargebee.com/api/v2/payment_sources

Method

limit[]
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.
subscription_id[]
optional, string, max chars=50
Unique subscription identifier that helps to retrieve the payment source of a subscription which has mandate associated to it.
include_deleted[]
optional, boolean, default=false
Indicates whether to include deleted objects in the list. The deleted objects have the attribute 'deleted' as 'true'.
sort_by[<sort-order>]
optional, string filter
Sorts based on the specified attribute.
Supported attributes : created_at, updated_at
Supported sort-orders : asc, desc

Example sort_by[asc] = "created_at"
This will sort the result based on the 'created_at' attribute in ascending(earliest first) order.
Filter Params
For operator usages, see the Pagination and Filtering section.
customer_id[<operator>]
optional, string filter
To filter based on Customer Id. Possible values are :
Supported operators : is, is_not, starts_with, in, not_in

Example customer_id[is] = "3bdjnDnsdQn"
customer_id[is][operator]
optional, string, min chars=1 filter
Possible values are :
Supported operators :

Example
customer_id[is_not][operator]
optional, string, min chars=1 filter
Possible values are :
Supported operators :

Example
customer_id[starts_with][operator]
optional, string, min chars=1 filter
Possible values are :
Supported operators :

Example
customer_id[in][operator]
optional, string filter
Possible values are :
Supported operators :

Example
customer_id[not_in][operator]
optional, string filter
Possible values are :
Supported operators :

Example
type[<operator>]
optional, enumerated string filter
Type of payment source. Possible values are : card, paypal_express_checkout, amazon_payments, direct_debit, generic, alipay, unionpay, apple_pay, wechat_pay, ideal, google_pay, sofort, bancontact, giropay, dotpay, upi, netbanking_emandates, venmo, pay_to, faster_payments, sepa_instant_transfer, automated_bank_transfer, klarna_pay_now, online_banking_poland
Supported operators : is, is_not, in, not_in

Example type[is] = "card"
type[is][operator]
optional, enumerated string filter
Possible values are : card, paypal_express_checkout, amazon_payments, direct_debit, generic, alipay, unionpay, apple_pay, wechat_pay, ideal, google_pay, sofort, bancontact, giropay, dotpay, upi, netbanking_emandates, venmo, pay_to, faster_payments, sepa_instant_transfer, automated_bank_transfer, klarna_pay_now, online_banking_poland
Supported operators :

Example
type[is_not][operator]
optional, enumerated string filter
Possible values are : card, paypal_express_checkout, amazon_payments, direct_debit, generic, alipay, unionpay, apple_pay, wechat_pay, ideal, google_pay, sofort, bancontact, giropay, dotpay, upi, netbanking_emandates, venmo, pay_to, faster_payments, sepa_instant_transfer, automated_bank_transfer, klarna_pay_now, online_banking_poland
Supported operators :

Example
type[in][operator]
optional, string filter
Possible values are :
Supported operators :

Example
type[not_in][operator]
optional, string filter
Possible values are :
Supported operators :

Example
status[<operator>]
optional, enumerated string filter
Current status of the payment source. Possible values are : valid, expiring, expired, invalid, pending_verification
Supported operators : is, is_not, in, not_in

Example status[is] = "valid"
status[is][operator]
optional, enumerated string filter
Possible values are : valid, expiring, expired, invalid, pending_verification
Supported operators :

Example
status[is_not][operator]
optional, enumerated string filter
Possible values are : valid, expiring, expired, invalid, pending_verification
Supported operators :

Example
status[in][operator]
optional, string filter
Possible values are :
Supported operators :

Example
status[not_in][operator]
optional, string filter
Possible values are :
Supported operators :

Example
updated_at[<operator>]
optional, timestamp(UTC) in seconds filter
Timestamp indicating when this payment source resource was last updated. Possible values are :
Supported operators : after, before, on, between

Example updated_at[after] = "1435054328"
updated_at[after][operator]
optional, timestamp(UTC) in seconds filter
Possible values are :
Supported operators :

Example
updated_at[before][operator]
optional, timestamp(UTC) in seconds filter
Possible values are :
Supported operators :

Example
updated_at[on][operator]
optional, timestamp(UTC) in seconds filter
Possible values are :
Supported operators :

Example
updated_at[between][operator]
optional, string filter
Possible values are :
Supported operators :

Example
created_at[<operator>]
optional, timestamp(UTC) in seconds filter
Timestamp indicating when this payment source resource is created. Possible values are :
Supported operators : after, before, on, between

Example created_at[after] = "1435054328"
created_at[after][operator]
optional, timestamp(UTC) in seconds filter
Possible values are :
Supported operators :

Example
created_at[before][operator]
optional, timestamp(UTC) in seconds filter
Possible values are :
Supported operators :

Example
created_at[on][operator]
optional, timestamp(UTC) in seconds filter
Possible values are :
Supported operators :

Example
created_at[between][operator]
optional, string filter
Possible values are :
Supported operators :

Example
payment_source payment_source
always returned
Resource object representing payment_source
next_offset 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`.

Sample admin console URL

https://{site}.chargebee.com/admin-console/payment_sources/123x

Switches the gateway in which this payment source information is stored.

This is applicable only if the payment source is present in Spreedly vault.

Notes

This operation does not support switching between Braintree and Stripe. If you need help using this API, contact support@chargebee.com.

Sample Request
curl  https://{site}.chargebee.com/api/v2/payment_sources/pm___test__XpbTXGTSRp4XbjFJ/switch_gateway_account \
     -u {site_api_key}:\
     -d gateway_account_id="gw___test__5SK2lMpwSRp4Wrl37"
copy
Click to Copy
curl  https://{site}.chargebee.com/api/v2/payment_sources/pm___test__XpbTXGTSRp4XbjFJ/switch_gateway_account \
     -u {site_api_key}:\
     -d gateway_account_id="gw___test__5SK2lMpwSRp4Wrl37"

Sample Response [ JSON ]

Show more...
{
    "customer": {
        "allow_direct_debit": false,
        "auto_collection": "on",
        "card_status": "valid",
        "created_at": 1517487256,
        "deleted": false,
        "excess_payments": 0,
        "first_name": "Mark",
        "id": "__test__XpbTXGTSRp4X57FI",
        "last_name": "Henry",
        "net_term_days": 0,
        "object": "customer",
        "payment_method": {
            "gateway": "pin",
            "gateway_account_id": "gw___test__5SK2lMpwSRp4Wrl37",
            "object": "payment_method",
            "reference_id": "UKZpy3LgND7f5jOIeAjwXbRsbEx",
            "status": "valid",
            "type": "card"
        },
        "pii_cleared": "active",
        "preferred_currency_code": "USD",
        "primary_payment_source_id": "pm___test__XpbTXGTSRp4XbjFJ",
        "promotional_credits": 0,
        "refundable_credits": 0,
        "resource_version": 1517487258458,
        "taxability": "taxable",
        "unbilled_charges": 0,
        "updated_at": 1517487258
    },
    "payment_source": {
        "card": {
            "brand": "visa",
            "expiry_month": 12,
            "expiry_year": 2022,
            "funding_type": "not_known",
            "iin": "411111",
            "last4": "1111",
            "masked_number": "************1111",
            "object": "card"
        },
        "created_at": 1517487258,
        "customer_id": "__test__XpbTXGTSRp4X57FI",
        "deleted": false,
        "gateway": "pin",
        "gateway_account_id": "gw___test__5SK2lMpwSRp4Wrl37",
        "id": "pm___test__XpbTXGTSRp4XbjFJ",
        "object": "payment_source",
        "reference_id": "UKZpy3LgND7f5jOIeAjwXbRsbEx",
        "resource_version": 1517487258565,
        "status": "valid",
        "type": "card",
        "updated_at": 1517487258
    }
}

URL Format POST

https://{site}.chargebee.com/api/v2/payment_sources/{cust-payment-source-id}/switch_gateway_account

Method

gateway_account_id[]
required, string, max chars=50
The gateway account you want to switch to.
customer customer
always returned
Resource object representing customer
payment_source payment_source
always returned
Resource object representing payment_source

Sample admin console URL

https://{site}.chargebee.com/admin-console/payment_sources/123x

Copies this payment source information to the gateway specified in the API.

This is useful if you want to port your customer’s card details into another gateway.

Notes

This operation does not support copying of cards from Stripe and Braintree gateways. If you need help using this API, contact support@chargebee.com.

Sample Request
curl  https://{site}.chargebee.com/api/v2/payment_sources/pm___test__XpbTXGTSRp4TUQEq/export_payment_source \
     -u {site_api_key}:\
     -d gateway_account_id="gw___test__5SK2lMpwSRp4SXM2z"
copy
Click to Copy
curl  https://{site}.chargebee.com/api/v2/payment_sources/pm___test__XpbTXGTSRp4TUQEq/export_payment_source \
     -u {site_api_key}:\
     -d gateway_account_id="gw___test__5SK2lMpwSRp4SXM2z"

Sample Response [ JSON ]

Show more...
{
    "third_party_payment_method": {
        "gateway": "stripe",
        "gateway_account_id": "gw___test__5SK2lMpwSRp4SXM2z",
        "object": "third_party_payment_method",
        "reference_id": "cus_J7rVdlHN2uZpSx/card_1IVbmjJv9j0DyntJPYARLiEw",
        "type": "card"
    }
}

URL Format POST

https://{site}.chargebee.com/api/v2/payment_sources/{cust-payment-source-id}/export_payment_source

Method

gateway_account_id[]
required, string, max chars=50
The gateway account you want to copy the card.
third_party_payment_method third_party_payment_method
always returned
Resource object representing third_party_payment_method

Sample admin console URL

https://{site}.chargebee.com/admin-console/payment_sources/123x

Deletes a payment source. Once the payment source is deleted, if

  • Deleted payment source is Primary, and Backup is available
    • The Backup payment source will become the Primary payment source.
  • Deleted payment source is Primary, and no Backup is available
    • The other payment source available, but not assigned to any subscription, will become the Primary payment source.

      Note: When multiple payment sources exist, the payment method added most recently will be considered.

    • If other payment sources available are assigned to subscriptions, the auto collection attribute for the customer will be set to Off, and the events card_deleted and payment_source_deleted will be triggered.
  • Deleted payment source is attached to subscriptions
    • Dunning will be initiated for subscriptions attached to this payment source if auto collection is set to On, and when no customer default is present.

If there is no such payment source present in the gateway for the customer, this API will return successfully without throwing any error.

Note:
If you delete the only available payment method of a customer in Chargebee, it also deletes the customer’s record at the gateway. To delete the payment method locally(delete only in Chargebee), use Local Delete a Payment Source API.

Notes

Sample Request
curl  https://{site}.chargebee.com/api/v2/payment_sources/pm___test__XpbTXGTSRp4SEvEe/delete \
     -X POST  \
     -u {site_api_key}:
copy
Click to Copy
curl  https://{site}.chargebee.com/api/v2/payment_sources/pm___test__XpbTXGTSRp4SEvEe/delete \
     -X POST  \
     -u {site_api_key}:

Sample Response [ JSON ]

Show more...
{
    "customer": {
        "allow_direct_debit": false,
        "auto_collection": "off",
        "card_status": "no_card",
        "created_at": 1517487236,
        "deleted": false,
        "excess_payments": 0,
        "first_name": "Mark",
        "id": "__test__XpbTXGTSRp4Rx1Ed",
        "last_name": "Henry",
        "net_term_days": 0,
        "object": "customer",
        "pii_cleared": "active",
        "preferred_currency_code": "USD",
        "promotional_credits": 0,
        "refundable_credits": 0,
        "resource_version": 1517487238746,
        "taxability": "taxable",
        "unbilled_charges": 0,
        "updated_at": 1517487238
    },
    "payment_source": {
        "card": {
            "brand": "visa",
            "expiry_month": 12,
            "expiry_year": 2022,
            "funding_type": "credit",
            "iin": "411111",
            "last4": "1111",
            "masked_number": "************1111",
            "object": "card"
        },
        "created_at": 1517487237,
        "customer_id": "__test__XpbTXGTSRp4Rx1Ed",
        "deleted": true,
        "gateway": "stripe",
        "gateway_account_id": "gw___test__5SK2lMpwSRp4Mx02v",
        "id": "pm___test__XpbTXGTSRp4SEvEe",
        "issuing_country": "US",
        "object": "payment_source",
        "reference_id": "cus_J7rVgQok1LkbJ9/card_1IVbmbJv9j0DyntJhbTqsfn1",
        "resource_version": 1517487237828,
        "status": "valid",
        "type": "card",
        "updated_at": 1517487237
    }
}

URL Format POST

https://{site}.chargebee.com/api/v2/payment_sources/{cust-payment-source-id}/delete

Method

customer customer
always returned
Resource object representing customer
payment_source payment_source
always returned
Resource object representing payment_source

Sample admin console URL

https://{site}.chargebee.com/admin-console/payment_sources/123x

true


Use this API to delete a payment method from a customer record in Chargebee. This operation only removes the payment source from Chargebee; it does not delete the payment method from the payment gateway.


This action is irreversible. Once deleted, the payment source ID is permanently removed from the customer's record in Chargebee.

Implications of the operation

Payment Collection Failure on Renewal


If the customer is unaware that their payment method has been removed, renewal payments may fail. Depending on your site's configuration, this can lead to dunning, suspension, or cancellation of their subscription.

Invoices Entering Dunning


If a renewal attempt fails due to a missing payment method, the invoice enters dunning. Chargebee follows the configured dunning rules (such as retries and reminder emails). If dunning fails, the invoice may be voided, written off, or lead to subscription cancellation.

Impact on Customer Experience


Removing a payment method without notifying the customer can lead to failed renewals and service disruption. Ensure proactive communication to avoid confusion or dissatisfaction.

FAQs

1. I am getting an error `resource_not_found`. What should I do?


Verify that the customer ID and payment source ID in your request are correct and exist on your Chargebee site.

Notes

Sample Request
curl  https://{site}.chargebee.com/api/v2/payment_sources/pm___test__XpbTXGTSRp4V0hEw/delete_local \
     -X POST  \
     -u {site_api_key}:
copy
Click to Copy
curl  https://{site}.chargebee.com/api/v2/payment_sources/pm___test__XpbTXGTSRp4V0hEw/delete_local \
     -X POST  \
     -u {site_api_key}:

Sample Response [ JSON ]

Show more...
{
    "customer": {
        "allow_direct_debit": false,
        "auto_collection": "on",
        "card_status": "no_card",
        "created_at": 1517487247,
        "deleted": false,
        "excess_payments": 0,
        "first_name": "Mark",
        "id": "__test__XpbTXGTSRp4UhfEv",
        "last_name": "Henry",
        "net_term_days": 0,
        "object": "customer",
        "pii_cleared": "active",
        "preferred_currency_code": "USD",
        "promotional_credits": 0,
        "refundable_credits": 0,
        "resource_version": 1517487248592,
        "taxability": "taxable",
        "unbilled_charges": 0,
        "updated_at": 1517487248
    },
    "payment_source": {
        "card": {
            "brand": "visa",
            "expiry_month": 12,
            "expiry_year": 2022,
            "funding_type": "credit",
            "iin": "411111",
            "last4": "1111",
            "masked_number": "************1111",
            "object": "card"
        },
        "created_at": 1517487248,
        "customer_id": "__test__XpbTXGTSRp4UhfEv",
        "deleted": true,
        "gateway": "stripe",
        "gateway_account_id": "gw___test__5SK2lMpwSRp4Mx02v",
        "id": "pm___test__XpbTXGTSRp4V0hEw",
        "issuing_country": "US",
        "object": "payment_source",
        "reference_id": "cus_J7rVsWKqWFpyBS/card_1IVbmmJv9j0DyntJVAKlFn5a",
        "resource_version": 1517487248475,
        "status": "valid",
        "type": "card",
        "updated_at": 1517487248
    }
}

URL Format POST

https://{site}.chargebee.com/api/v2/payment_sources/{cust-payment-source-id}/delete_local

Method

customer customer
always returned
Resource object representing customer
payment_source payment_source
always returned
Resource object representing payment_source

Sample admin console URL

https://{site}.chargebee.com/admin-console/payment_sources/123x