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": 1517501366,
"customer_id": "__test__KyVnHhSBWSnun3m",
"deleted": false,
"gateway": "stripe",
"gateway_account_id": "gw___test__KyVnGlSBWSlFuCx",
"id": "pm___test__KyVnHhSBWSoLV3o",
"issuing_country": "US",
"object": "payment_source",
"reference_id": "cus_I57Fg22l3szyZI/card_1HUx0bJv9j0DyntJi5f2GxEj",
"resource_version": 1517501366000,
"status": "valid",
"type": "card",
"updated_at": 1517501366
}
Identifier of the payment source.
string, max chars=40
Version number of this resource. Each update of this resource results in incremental change of this number. This attribute will be present only if the resource has been updated after 2016-09-28.
optional, long
Timestamp indicating when this payment source resource was last updated.
optional, timestamp(UTC) in seconds
Timestamp indicating when this payment source resource is created.
timestamp(UTC) in seconds
Identifier of the customer with whom this payment source is associated.
string, max chars=50
Type of payment source.
enumerated stringPossible 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.genericGeneric Payment Method.alipayAlipay Payments.unionpayUnionPay Payments.apple_payApple Pay Payments.wechat_payWeChat Pay Payments.idealiDEAL Payments.google_payGoogle Pay Payments.sofortSofort Payments.bancontactBancontact Card Payments.giropaygiropay Payments.dotpayDotpay Payments.
Show all values[+]
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.
string, max chars=200
Current status of the payment source.
enumerated string, default=validPossible 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 expired.invalidThe 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.
Name of the gateway this payment source is stored with.
enumerated stringPossible values are
chargebeeChargebee test gateway.stripeStripe payment gateway.wepayWePay Gateway.braintreeBraintree payment gateway.authorize_netAuthorize.net payment gateway.paypal_proPaypal Pro Account.pinPin payment gateway.ewayeWAY Account.eway_rapideWAY Rapid gateway.worldpayWorldPay payment gateway.balanced_paymentsBalanced payment gateway.beanstreamBambora (formerly Beanstream).bluepayBluePay payment gateway.elavonElavon Virtual Merchant.first_data_globalFirst Data Global Gateway Virtual Terminal Account.hdfcHDFC Account.migsMasterCard Internet Gateway Service.nmiNMI gateway.ogoneIngenico ePayments (formerly Ogone).paymillPAYMILL payment gateway.paypal_payflow_proPayPal Payflow Pro gateway.sage_paySage Pay gateway.tco2Checkout payment gateway.wirecardWireCard Account.amazon_paymentsThe amazon payments.paypal_express_checkoutThe paypal gateway.gocardlessGoCardless.adyenAdyen.orbitalChase Paymentech(Orbital) Gateway.moneris_usMoneris USA Gateway.monerisMoneris Gateway.bluesnapBlueSnap gateway.cybersourceCyberSource gateway.vantivVantiv gateway.checkout_comCheckout.com Gateway.paypalPaypal Commerce.ingenico_directIngenico ePayments.exactExact Payments gateway.not_applicableIndicates that payment gateway is not applicable for this resource.
Show all values[+]
The gateway account to which this payment source is stored with.
optional, string, max chars=50
The IP address of the customer. Used primarily for referral integration and EU VAT validation.
optional, string, max chars=50
2-letter(alpha2) ISO country code.
optional, string, max chars=50
Indicates that this resource has been deleted.
boolean
Card details associated with this payment source.
optional, card
Cardholder's first name.
optional, string, max chars=50
Cardholder's last name.
optional, string, max chars=50
The Issuer Identification Number, i.e. the first six digits of the card number.
string, min chars=6, max chars=6
Last four digits of the card number.
string, min chars=4, max chars=4
Card brand.
enumerated stringPossible 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.
Card Funding type.
enumerated stringPossible values are
creditA credit card.debitA debit card.prepaidA prepaid card.not_knownAn unknown card.
Card expiry month.
integer, min=1, max=12
Address line 1, as available in card billing address.
optional, string, max chars=150
Address line 2, as available in card billing address.
optional, string, max chars=150
City, as available in card billing address.
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
).
optional, string, max chars=50
The state/province name.
optional, string, max chars=50
Postal or Zip code, as available in card billing address.
optional, string, max chars=20
Masked credit card number that is safe to show.
optional, string, max chars=19
Bank account details the direct debit or ACH agreement/mandate created with this payment source.
optional, bank_account
Last four digits of the bank account number.
string, min chars=4, max chars=4
Account holder’s name as per bank account.
optional, string, max chars=300
Name of account holder’s bank.
optional, string, max chars=100
Mandate Id. Applicable for SEPA, BACS, Autogiro, and BECS.
optional, string, min chars=1, max chars=50
For Authorize.net ACH users only. Indicates the type of account.
optional, enumerated stringPossible values are
checkingChecking Account.savingsSavings Account.business_checkingBusiness Checking Account.
For Authorize.net ACH users only. Indicates the type of eCheck.
optional, enumerated stringPossible 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.
For Stripe ACH users only. Indicates the account holder type.
optional, enumerated stringPossible values are
individualIndividual.companyCompany.
Amazon payments details associated with this payment source.
optional, amazon_payment
Amazon payment attributes
Email address associated with Amazon payment account.
optional, string, max chars=70
Billing agreement id.
optional, string, max chars=50
PayPal Express Checkout details associated with this payment source.
optional, paypal
Email address associated with PayPal Express Checkout.
optional, string, max chars=70
Billing agreement id.
optional, string, max chars=50
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.
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__KyVnGlSBWSlFuCx" \
-d customer_id="__test__KyVnHhSBWSnun3m" \
-d type="card" \
-d tmp_token="tok_1HUx0bJv9j0DyntJCrDx8S6q"
copy
curl https://{site}.chargebee.com/api/v2/payment_sources/create_using_temp_token \
-u {site_api_key}:\
-d gateway_account_id="gw___test__KyVnGlSBWSlFuCx" \
-d customer_id="__test__KyVnHhSBWSnun3m" \
-d type="card" \
-d tmp_token="tok_1HUx0bJv9j0DyntJCrDx8S6q"
Sample Response [ JSON ]
Show more...
{
"customer": {
"allow_direct_debit": false,
"auto_collection": "on",
"card_status": "valid",
"created_at": 1517501365,
"deleted": false,
"excess_payments": 0,
"first_name": "Mark",
"id": "__test__KyVnHhSBWSnun3m",
"last_name": "Henry",
"net_term_days": 0,
"object": "customer",
"payment_method": {
"gateway": "stripe",
"gateway_account_id": "gw___test__KyVnGlSBWSlFuCx",
"object": "payment_method",
"reference_id": "cus_I57Fg22l3szyZI/card_1HUx0bJv9j0DyntJi5f2GxEj",
"status": "valid",
"type": "card"
},
"pii_cleared": "active",
"preferred_currency_code": "USD",
"primary_payment_source_id": "pm___test__KyVnHhSBWSoLV3o",
"promotional_credits": 0,
"refundable_credits": 0,
"resource_version": 1517501366000,
"taxability": "taxable",
"unbilled_charges": 0,
"updated_at": 1517501366
},
"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": 1517501366,
"customer_id": "__test__KyVnHhSBWSnun3m",
"deleted": false,
"gateway": "stripe",
"gateway_account_id": "gw___test__KyVnGlSBWSlFuCx",
"id": "pm___test__KyVnHhSBWSoLV3o",
"issuing_country": "US",
"object": "payment_source",
"reference_id": "cus_I57Fg22l3szyZI/card_1HUx0bJv9j0DyntJi5f2GxEj",
"resource_version": 1517501366000,
"status": "valid",
"type": "card",
"updated_at": 1517501366
}
}
URL Format POST
https://{site}.chargebee.com/api/v2/payment_sources/create_using_temp_token
Identifier of the customer with whom this payment source is associated.
required, string, max chars=50
The gateway account to which the payment source is associated.
optional, string, max chars=50
Type of payment source.
required, enumerated stringPossible 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.genericGeneric Payment Method.alipayAlipay Payments.unionpayUnionPay Payments.apple_payApple Pay Payments.wechat_payWeChat Pay Payments.idealiDEAL Payments.google_payGoogle Pay Payments.sofortSofort Payments.bancontactBancontact Card Payments.giropaygiropay Payments.dotpayDotpay Payments.
Show all values[+]
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.
required, string, max chars=65k
2-letter (alpha2) ISO country code. Indicates your customer's payment method country of issuance. Applicable for PayPal via Braintree.
optional, string, max chars=50
replace_primary_payment_source
Indicates whether the primary payment source should be replaced with this payment source.
optional, boolean, default=false
Resource object representing customer.
always returned
Resource object representing payment_source.
always returned
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.
Sample Request
curl https://{site}.chargebee.com/api/v2/payment_sources/create_using_permanent_token \
-u {site_api_key}:\
-d customer_id="__test__KyVnHhSBWSnb23d" \
-d gateway_account_id="gw___test__KyVnGlSBWSlFuCx" \
-d reference_id="cus_I57FwX7rPyN1SN" \
-d type="card"
copy
curl https://{site}.chargebee.com/api/v2/payment_sources/create_using_permanent_token \
-u {site_api_key}:\
-d customer_id="__test__KyVnHhSBWSnb23d" \
-d gateway_account_id="gw___test__KyVnGlSBWSlFuCx" \
-d reference_id="cus_I57FwX7rPyN1SN" \
-d type="card"
Sample Response [ JSON ]
Show more...
{
"customer": {
"allow_direct_debit": false,
"auto_collection": "on",
"card_status": "valid",
"created_at": 1517501364,
"deleted": false,
"excess_payments": 0,
"first_name": "Mark",
"id": "__test__KyVnHhSBWSnb23d",
"last_name": "Henry",
"net_term_days": 0,
"object": "customer",
"payment_method": {
"gateway": "stripe",
"gateway_account_id": "gw___test__KyVnGlSBWSlFuCx",
"object": "payment_method",
"reference_id": "cus_I57FwX7rPyN1SN/card_1HUx0aJv9j0DyntJP9EMa6QN",
"status": "valid",
"type": "card"
},
"pii_cleared": "active",
"preferred_currency_code": "USD",
"primary_payment_source_id": "pm___test__KyVnHhSBWSns73i",
"promotional_credits": 0,
"refundable_credits": 0,
"resource_version": 1517501365000,
"taxability": "taxable",
"unbilled_charges": 0,
"updated_at": 1517501365
},
"payment_source": {
"card": {
"brand": "visa",
"expiry_month": 12,
"expiry_year": 2022,
"funding_type": "credit",
"iin": "******",
"last4": "1111",
"masked_number": "************1111",
"object": "card"
},
"created_at": 1517501365,
"customer_id": "__test__KyVnHhSBWSnb23d",
"deleted": false,
"gateway": "stripe",
"gateway_account_id": "gw___test__KyVnGlSBWSlFuCx",
"id": "pm___test__KyVnHhSBWSns73i",
"issuing_country": "US",
"object": "payment_source",
"reference_id": "cus_I57FwX7rPyN1SN/card_1HUx0aJv9j0DyntJP9EMa6QN",
"resource_version": 1517501365000,
"status": "valid",
"type": "card",
"updated_at": 1517501365
}
}
URL Format POST
https://{site}.chargebee.com/api/v2/payment_sources/create_using_permanent_token
Identifier of the customer with whom this payment source is associated.
required, string, max chars=50
The type of payment method. For more details refer
Update payment method for a customer API under Customer resource.
required, enumerated stringPossible 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.genericGeneric Payment Method.alipayAlipay Payments.unionpayUnionPay Payments.apple_payApple Pay Payments.wechat_payWeChat Pay Payments.idealiDEAL Payments.google_payGoogle Pay Payments.sofortSofort Payments.bancontactBancontact Card Payments.giropaygiropay Payments.dotpayDotpay Payments.
Show all values[+]
The gateway account to which the payment source is associated.
optional, string, max chars=50
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 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.
required, string, max chars=200
2-letter (alpha2) ISO country code. Indicates your customer's payment method country of issuance. Applicable for PayPal via Braintree.
optional, string, max chars=50
replace_primary_payment_source
Indicates whether the primary payment source should be replaced with this payment source.
optional, boolean, default=false
Resource object representing customer.
always returned
Resource object representing payment_source.
always returned
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.
Sample Request
curl https://{site}.chargebee.com/api/v2/payment_sources/create_using_token \
-u {site_api_key}:\
-d customer_id="__test__KyVnHhSBWSoOF3s" \
-d token_id="cb_tok___test__KyVnHhSBWSofa3u"
copy
curl https://{site}.chargebee.com/api/v2/payment_sources/create_using_token \
-u {site_api_key}:\
-d customer_id="__test__KyVnHhSBWSoOF3s" \
-d token_id="cb_tok___test__KyVnHhSBWSofa3u"
Sample Response [ JSON ]
Show more...
{
"customer": {
"allow_direct_debit": false,
"auto_collection": "on",
"card_status": "valid",
"created_at": 1517501367,
"deleted": false,
"excess_payments": 0,
"first_name": "Mark",
"id": "__test__KyVnHhSBWSoOF3s",
"last_name": "Henry",
"net_term_days": 0,
"object": "customer",
"payment_method": {
"gateway": "stripe",
"gateway_account_id": "gw___test__KyVnGlSBWSlFuCx",
"object": "payment_method",
"reference_id": "cus_I57Fno0ydsGUCW/card_1HUx0dJv9j0DyntJLGB1kBfQ",
"status": "valid",
"type": "card"
},
"pii_cleared": "active",
"preferred_currency_code": "USD",
"primary_payment_source_id": "pm___test__KyVnHhSBWSopL3w",
"promotional_credits": 0,
"refundable_credits": 0,
"resource_version": 1517501368000,
"taxability": "taxable",
"unbilled_charges": 0,
"updated_at": 1517501368
},
"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": 1517501368,
"customer_id": "__test__KyVnHhSBWSoOF3s",
"deleted": false,
"gateway": "stripe",
"gateway_account_id": "gw___test__KyVnGlSBWSlFuCx",
"id": "pm___test__KyVnHhSBWSopL3w",
"issuing_country": "US",
"object": "payment_source",
"reference_id": "cus_I57Fno0ydsGUCW/card_1HUx0dJv9j0DyntJLGB1kBfQ",
"resource_version": 1517501368000,
"status": "valid",
"type": "card",
"updated_at": 1517501368
}
}
URL Format POST
https://{site}.chargebee.com/api/v2/payment_sources/create_using_token
Identifier of the customer with whom this payment source is associated.
required, string, max chars=50
replace_primary_payment_source
Indicates whether the primary payment source should be replaced with this payment source.
optional, boolean, default=false
Token generated by Chargebee JS representing payment method details.
required, string, max chars=40
Resource object representing customer.
always returned
Resource object representing payment_source.
always returned
Used to attach the card to the customer after 3DS completion.
Learn more on the 3DS implementation via Chargebee APIs.
Sample Request
curl https://{site}.chargebee.com/api/v2/payment_sources/create_using_payment_intent \
-u {site_api_key}:\
-d customer_id="__test__KyVnHhSBWSlF83W" \
-d payment_intent[gateway_account_id]="gw___test__KyVnGlSBWSlFuCx" \
-d payment_intent[gw_token]="pi_1HUx0SJv9j0DyntJBnkch3u2"
copy
curl https://{site}.chargebee.com/api/v2/payment_sources/create_using_payment_intent \
-u {site_api_key}:\
-d customer_id="__test__KyVnHhSBWSlF83W" \
-d payment_intent[gateway_account_id]="gw___test__KyVnGlSBWSlFuCx" \
-d payment_intent[gw_token]="pi_1HUx0SJv9j0DyntJBnkch3u2"
Sample Response [ JSON ]
Show more...
{
"customer": {
"allow_direct_debit": false,
"auto_collection": "on",
"card_status": "valid",
"created_at": 1517501355,
"deleted": false,
"excess_payments": 0,
"first_name": "Mark",
"id": "__test__KyVnHhSBWSlF83W",
"last_name": "Henry",
"net_term_days": 0,
"object": "customer",
"payment_method": {
"gateway": "stripe",
"gateway_account_id": "gw___test__KyVnGlSBWSlFuCx",
"object": "payment_method",
"reference_id": "cus_I57Ef9Ih1d9yJh/pm_1HUx0RJv9j0DyntJKbozcx4I",
"status": "valid",
"type": "card"
},
"pii_cleared": "active",
"preferred_currency_code": "USD",
"primary_payment_source_id": "pm___test__KyVnHhSBWSnYG3Z",
"promotional_credits": 0,
"refundable_credits": 0,
"resource_version": 1517501363000,
"taxability": "taxable",
"unbilled_charges": 0,
"updated_at": 1517501363
},
"payment_source": {
"card": {
"brand": "visa",
"expiry_month": 7,
"expiry_year": 2050,
"funding_type": "credit",
"iin": "******",
"last4": "3055",
"masked_number": "************3055",
"object": "card"
},
"created_at": 1517501363,
"customer_id": "__test__KyVnHhSBWSlF83W",
"deleted": false,
"gateway": "stripe",
"gateway_account_id": "gw___test__KyVnGlSBWSlFuCx",
"id": "pm___test__KyVnHhSBWSnYG3Z",
"issuing_country": "US",
"object": "payment_source",
"reference_id": "cus_I57Ef9Ih1d9yJh/pm_1HUx0RJv9j0DyntJKbozcx4I",
"resource_version": 1517501363000,
"status": "valid",
"type": "card",
"updated_at": 1517501363
}
}
URL Format POST
https://{site}.chargebee.com/api/v2/payment_sources/create_using_payment_intent
Identifier of the customer with whom this payment source is associated.
required, string, max chars=50
replace_primary_payment_source
Indicates whether the primary payment source should be replaced with this payment source.
optional, boolean, default=false
Parameters for payment_intent
pass parameters as payment_intent[<param name>]
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.
optional, string, max chars=150
payment_intent[gateway_account_id]
The gateway account used for performing the 3DS flow. Applicable when you are using gateway APIs directly for completing the 3DS flow.
optional, string, max chars=50
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.
optional, string, max chars=65k
payment_intent[reference_id]
Identifier for Braintree permanent token. Applicable when you are using Braintree APIs for completing the 3DS flow.
optional, string, max chars=65k
payment_intent[additional_info]
Applicable only for Braintree gateway. Can be used only for Braintree’s
Advance Fraud Management feature. Pass a stringified JSON containing the
device_session_id
and
fraud_merchant_id
as an input to
fingerprint
. Here’s a
sample to it.
optional, jsonobject
Resource object representing customer.
always returned
Resource object representing payment_source.
always returned
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.
Sample Request
curl https://{site}.chargebee.com/api/v2/payment_sources/create_card \
-u {site_api_key}:\
-d customer_id="__test__KyVnHhSBWSlAP3P" \
-d card[number]="378282246310005" \
-d card[cvv]="100" \
-d card[expiry_year]=2022 \
-d card[expiry_month]=12
copy
curl https://{site}.chargebee.com/api/v2/payment_sources/create_card \
-u {site_api_key}:\
-d customer_id="__test__KyVnHhSBWSlAP3P" \
-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": 1517501354,
"deleted": false,
"excess_payments": 0,
"first_name": "Mark",
"id": "__test__KyVnHhSBWSlAP3P",
"last_name": "Henry",
"net_term_days": 0,
"object": "customer",
"payment_method": {
"gateway": "chargebee",
"gateway_account_id": "gw___test__KyVnGlSBWSkQmC6",
"object": "payment_method",
"reference_id": "tok___test__KyVnHhSBWSlBS3R",
"status": "valid",
"type": "card"
},
"pii_cleared": "active",
"preferred_currency_code": "USD",
"primary_payment_source_id": "pm___test__KyVnHhSBWSlBW3S",
"promotional_credits": 0,
"refundable_credits": 0,
"resource_version": 1517501354000,
"taxability": "taxable",
"unbilled_charges": 0,
"updated_at": 1517501354
},
"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": 1517501354,
"customer_id": "__test__KyVnHhSBWSlAP3P",
"deleted": false,
"gateway": "chargebee",
"gateway_account_id": "gw___test__KyVnGlSBWSkQmC6",
"id": "pm___test__KyVnHhSBWSlBW3S",
"object": "payment_source",
"reference_id": "tok___test__KyVnHhSBWSlBS3R",
"resource_version": 1517501354000,
"status": "valid",
"type": "card",
"updated_at": 1517501354
}
}
URL Format POST
https://{site}.chargebee.com/api/v2/payment_sources/create_card
Identifier of the customer with whom this payment source is associated.
required, string, max chars=50
replace_primary_payment_source
Indicates whether the primary payment source should be replaced with this payment source.
optional, boolean, default=false
Parameters for card
pass parameters as card[<param name>]
The gateway account in which this payment source is stored.
optional, string, max chars=50
Cardholder's first name.
optional, string, max chars=50
Cardholder's last name.
optional, string, max chars=50
The credit card number without any format. If you are using
Braintree.js, you can specify the Braintree encrypted card number here.
required, string, max chars=1500
Card expiry month.
required, integer, min=1, max=12
Card expiry year.
required, integer
The card verification value (CVV). If you are using
Braintree.js, you can specify the Braintree encrypted CVV here.
optional, string, max chars=520
Address line 1, as available in card billing address.
optional, string, max chars=150
Address line 2, as available in card billing address.
optional, string, max chars=150
City, as available in card billing address.
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
).
optional, string, max chars=50
The state/province name. Is set by Chargebee automatically for US, Canada and India If state_code
is provided.
optional, string, max chars=50
Postal or Zip code, as available in card billing address.
optional, string, max chars=20
Resource object representing customer.
always returned
Resource object representing payment_source.
always returned
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.
ACH is an electronic network for passing financial transactions in the US. Chargebee currently supports ACH via Stripe and Authorize.Net.
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.
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.
Sample Request
curl https://{site}.chargebee.com/api/v2/payment_sources/create_bank_account \
-u {site_api_key}:\
-d customer_id="__test__KyVnHhSBWSkoO3J" \
-d bank_account[gateway_account_id]="gw___test__KyVnGlSBWSkkSCv" \
-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
curl https://{site}.chargebee.com/api/v2/payment_sources/create_bank_account \
-u {site_api_key}:\
-d customer_id="__test__KyVnHhSBWSkoO3J" \
-d bank_account[gateway_account_id]="gw___test__KyVnGlSBWSkkSCv" \
-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": 1517501353,
"deleted": false,
"excess_payments": 0,
"first_name": "Mark",
"id": "__test__KyVnHhSBWSkoO3J",
"last_name": "Henry",
"net_term_days": 0,
"object": "customer",
"payment_method": {
"gateway": "stripe",
"gateway_account_id": "gw___test__KyVnGlSBWSkkSCv",
"object": "payment_method",
"reference_id": "cus_I57Ebt4lgYuWpL/ba_1HUx0PJv9j0DyntJ3hXC8S3S",
"status": "pending_verification",
"type": "direct_debit"
},
"pii_cleared": "active",
"preferred_currency_code": "USD",
"primary_payment_source_id": "pm___test__KyVnHhSBWSl7i3L",
"promotional_credits": 0,
"refundable_credits": 0,
"resource_version": 1517501354000,
"taxability": "taxable",
"unbilled_charges": 0,
"updated_at": 1517501354
},
"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": 1517501354,
"customer_id": "__test__KyVnHhSBWSkoO3J",
"deleted": false,
"gateway": "stripe",
"gateway_account_id": "gw___test__KyVnGlSBWSkkSCv",
"id": "pm___test__KyVnHhSBWSl7i3L",
"issuing_country": "US",
"object": "payment_source",
"reference_id": "cus_I57Ebt4lgYuWpL/ba_1HUx0PJv9j0DyntJ3hXC8S3S",
"resource_version": 1517501354000,
"status": "pending_verification",
"type": "direct_debit",
"updated_at": 1517501354
}
}
URL Format POST
https://{site}.chargebee.com/api/v2/payment_sources/create_bank_account
Identifier of the customer with whom this payment source is associated.
required, string, max chars=50
2-letter(alpha2) ISO country code. Required when local bank details are provided, and not IBAN.
optional, string, max chars=50
replace_primary_payment_source
Indicates whether the primary payment source should be replaced with this payment source.
optional, boolean, default=false
Parameters for bank_account
pass parameters as bank_account[<param name>]
bank_account[gateway_account_id]
The gateway account in which this payment source is stored.
optional, string, max chars=50
Account holder’s International Bank Account Number. For the
GoCardless platform, this can be the
local bank details
.
optional, string, min chars=10, max chars=50
Account holder’s first name as per bank account. If not passed, details from customer details will be considered.
optional, string, max chars=150
Account holder’s last name as per bank account. If not passed, details from customer details will be considered.
optional, string, max chars=150
Account holder’s company name as per bank account. If not passed, details from customer details will be considered.
optional, string, max chars=250
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.
optional, string, max chars=70
Name of account holder’s bank.
optional, string, max chars=100
bank_account[account_number]
Account holder’s bank account number.
optional, string, min chars=4, max chars=17
bank_account[routing_number]
Bank account routing number.
optional, string, min chars=3, max chars=9
Indicates the bank code.
optional, string, max chars=20
bank_account[account_type]
For Authorize.net ACH users only. Indicates the type of account.
optional, enumerated stringPossible values are
checkingChecking Account.savingsSavings Account.business_checkingBusiness Checking Account.
bank_account[account_holder_type]
For Stripe ACH users only. Indicates the account holder type.
optional, enumerated stringPossible values are
individualIndividual.companyCompany.
bank_account[echeck_type]
For Authorize.net ACH users only. Indicates the type of eCheck.
optional, enumerated stringPossible 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.
bank_account[swedish_identity_number]
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.
optional, string, min chars=10, max chars=12
Resource object representing customer.
always returned
Resource object representing payment_source.
always returned
Merchants look to update card details when:
- The billing address of a customer has changed, and needs to be modified in Chargebee, and the payment gateway.
- When the expiration date of the card has been extended by the bank. (This usually happens when the date of expiry of the card is fast approaching.)
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.
Sample Request
curl https://{site}.chargebee.com/api/v2/payment_sources/pm___test__KyVnHhSBWSsY44e/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
curl https://{site}.chargebee.com/api/v2/payment_sources/pm___test__KyVnHhSBWSsY44e/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": 1517501382,
"deleted": false,
"excess_payments": 0,
"first_name": "Mark",
"id": "__test__KyVnHhSBWSsNl4d",
"last_name": "Henry",
"net_term_days": 0,
"object": "customer",
"payment_method": {
"gateway": "stripe",
"gateway_account_id": "gw___test__KyVnGlSBWSlFuCx",
"object": "payment_method",
"reference_id": "cus_I57FT7EzLw8nJX/card_1HUx0sJv9j0DyntJCxAZvOIw",
"status": "valid",
"type": "card"
},
"pii_cleared": "active",
"preferred_currency_code": "USD",
"primary_payment_source_id": "pm___test__KyVnHhSBWSsY44e",
"promotional_credits": 0,
"refundable_credits": 0,
"resource_version": 1517501384000,
"taxability": "taxable",
"unbilled_charges": 0,
"updated_at": 1517501384
},
"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": 1517501383,
"customer_id": "__test__KyVnHhSBWSsNl4d",
"deleted": false,
"gateway": "stripe",
"gateway_account_id": "gw___test__KyVnGlSBWSlFuCx",
"id": "pm___test__KyVnHhSBWSsY44e",
"issuing_country": "US",
"object": "payment_source",
"reference_id": "cus_I57FT7EzLw8nJX/card_1HUx0sJv9j0DyntJCxAZvOIw",
"resource_version": 1517501384000,
"status": "valid",
"type": "card",
"updated_at": 1517501384
}
}
URL Format POST
https://{site}.chargebee.com/api/v2/payment_sources/{cust_payment_source_id}/update_card
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.
optional, jsonobject
reference transaction used for Future purchases.Applicable only for Vantiv.
optional, string, max chars=50
Parameters for card
pass parameters as card[<param name>]
Cardholder's first name.
optional, string, max chars=50
Cardholder's last name.
optional, string, max chars=50
Card expiry month.
optional, integer, min=1, max=12
Card expiry year.
optional, integer
Address line 1, as available in card billing address.
optional, string, max chars=150
Address line 2, as available in card billing address.
optional, string, max chars=150
City, as available in card billing address.
optional, string, max chars=50
Postal or Zip code, as available in card billing address.
optional, string, max chars=20
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
).
optional, string, max chars=50
The state/province name.
optional, string, max chars=50
Resource object representing customer.
always returned
Resource object representing payment_source.
always returned
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 statement description for these deposits will be AMNTS: and the values of the two micro-deposits that were 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__KyVnHhSBWSt8z4m/verify_bank_account \
-u {site_api_key}:\
-d amount1=32 \
-d amount2=45
copy
curl https://{site}.chargebee.com/api/v2/payment_sources/pm___test__KyVnHhSBWSt8z4m/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": 1517501385,
"customer_id": "__test__KyVnHhSBWSssm4k",
"deleted": false,
"gateway": "stripe",
"gateway_account_id": "gw___test__KyVnGlSBWSkkSCv",
"id": "pm___test__KyVnHhSBWSt8z4m",
"issuing_country": "US",
"object": "payment_source",
"reference_id": "cus_I57FSqi0DOwtHY/ba_1HUx0uJv9j0DyntJ2HYmqzVB",
"resource_version": 1517501385000,
"status": "valid",
"type": "direct_debit",
"updated_at": 1517501385
}}
URL Format POST
https://{site}.chargebee.com/api/v2/payment_sources/{cust_payment_source_id}/verify_bank_account
Value of the micro-deposits sent to the bank account.
required, in cents, min=0
Value of the micro-deposits sent to the bank account.
required, in cents, min=0
Resource object representing payment_source.
always returned
Retrieves the payment source identified by the unique identifier.
Sample Request
curl https://{site}.chargebee.com/api/v2/payment_sources/pm___test__KyVnHhSBWSra54T \
-u {site_api_key}:
copy
curl https://{site}.chargebee.com/api/v2/payment_sources/pm___test__KyVnHhSBWSra54T \
-u {site_api_key}:
Sample Response [ JSON ]
Show more...
{"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": 1517501379,
"customer_id": "__test__KyVnHhSBWSrNR4S",
"deleted": false,
"gateway": "stripe",
"gateway_account_id": "gw___test__KyVnGlSBWSlFuCx",
"id": "pm___test__KyVnHhSBWSra54T",
"issuing_country": "US",
"object": "payment_source",
"reference_id": "cus_I57FFgqE1crgiM/card_1HUx0oJv9j0DyntJHVY1bVZC",
"resource_version": 1517501379000,
"status": "valid",
"type": "card",
"updated_at": 1517501379
}}
URL Format GET
https://{site}.chargebee.com/api/v2/payment_sources/{cust_payment_source_id}
Resource object representing payment_source.
always returned
Lists all the payment sources.
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
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": 1517501373,
"customer_id": "__test__KyVnHhSBWSpHb49",
"deleted": false,
"gateway": "pin",
"gateway_account_id": "gw___test__KyVnGlSBWSpIYD3",
"id": "pm___test__KyVnHhSBWSq0v4B",
"object": "payment_source",
"reference_id": "6x6hrKquLPZM6EVs17DL9188tGe",
"resource_version": 1517501373000,
"status": "valid",
"type": "card",
"updated_at": 1517501373
}},
{..}
],
"next_offset": "[\"1517501366000\",\"204000000438\"]"
}
URL Format GET
https://{site}.chargebee.com/api/v2/payment_sources
The number of resources to be returned.
optional, integer, default=10, min=1, max=100
Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set offset
to the value of next_offset
obtained in the previous iteration of the API call.
optional, string, max chars=1000
To filter based on Customer Id.
Supported operators : is, is_not, starts_with, in, not_in
Example → customer_id[is] = "3bdjnDnsdQn"
optional, 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.
Supported operators : is, is_not, in, not_in
Example → type[is] = "card"
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_not] = "valid"
optional, enumerated string filter
Timestamp indicating when this payment source resource was last updated.
Supported operators : after, before, on, between
Example → updated_at[before] = "1435054328"
optional, timestamp(UTC) in seconds filter
Timestamp indicating when this payment source resource is created.
Supported operators : after, before, on, between
Example → created_at[on] = "1435054328"
optional, timestamp(UTC) in seconds filter
Resource object representing payment_source.
always returned
next_offset
This attribute is returned only if more resources are present. To fetch the next set of resources use this value for the input parameter “offset”.
optional, string, max chars=1000
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__KyVnHhSBWSsKG4Y/switch_gateway_account \
-u {site_api_key}:\
-d gateway_account_id="gw___test__KyVnGlSBWSrumD9"
copy
curl https://{site}.chargebee.com/api/v2/payment_sources/pm___test__KyVnHhSBWSsKG4Y/switch_gateway_account \
-u {site_api_key}:\
-d gateway_account_id="gw___test__KyVnGlSBWSrumD9"
Sample Response [ JSON ]
Show more...
{
"customer": {
"allow_direct_debit": false,
"auto_collection": "on",
"card_status": "valid",
"created_at": 1517501381,
"deleted": false,
"excess_payments": 0,
"first_name": "Mark",
"id": "__test__KyVnHhSBWSs1M4X",
"last_name": "Henry",
"net_term_days": 0,
"object": "customer",
"payment_method": {
"gateway": "pin",
"gateway_account_id": "gw___test__KyVnGlSBWSrumD9",
"object": "payment_method",
"reference_id": "QKG1Z28GR7xgp5Z39wceXHMN8Ff",
"status": "valid",
"type": "card"
},
"pii_cleared": "active",
"preferred_currency_code": "USD",
"primary_payment_source_id": "pm___test__KyVnHhSBWSsKG4Y",
"promotional_credits": 0,
"refundable_credits": 0,
"resource_version": 1517501382000,
"taxability": "taxable",
"unbilled_charges": 0,
"updated_at": 1517501382
},
"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": 1517501382,
"customer_id": "__test__KyVnHhSBWSs1M4X",
"deleted": false,
"gateway": "pin",
"gateway_account_id": "gw___test__KyVnGlSBWSrumD9",
"id": "pm___test__KyVnHhSBWSsKG4Y",
"object": "payment_source",
"reference_id": "QKG1Z28GR7xgp5Z39wceXHMN8Ff",
"resource_version": 1517501382000,
"status": "valid",
"type": "card",
"updated_at": 1517501382
}
}
URL Format POST
https://{site}.chargebee.com/api/v2/payment_sources/{cust_payment_source_id}/switch_gateway_account
The gateway account you want to switch to.
required, string, max chars=50
Resource object representing customer.
always returned
Resource object representing payment_source.
always returned
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__KyVnHhSBWSq0v4B/export_payment_source \
-u {site_api_key}:\
-d gateway_account_id="gw___test__KyVnGlSBWSpG5D1"
copy
curl https://{site}.chargebee.com/api/v2/payment_sources/pm___test__KyVnHhSBWSq0v4B/export_payment_source \
-u {site_api_key}:\
-d gateway_account_id="gw___test__KyVnGlSBWSpG5D1"
Sample Response [ JSON ]
Show more...
{"third_party_payment_method": {
"gateway": "stripe",
"gateway_account_id": "gw___test__KyVnGlSBWSpG5D1",
"object": "third_party_payment_method",
"reference_id": "cus_I57FWryN58dPph/card_1HUx0kJv9j0DyntJ4JXiJ6Rs",
"type": "card"
}}
URL Format POST
https://{site}.chargebee.com/api/v2/payment_sources/{cust_payment_source_id}/export_payment_source
The gateway account you want to copy the card.
required, string, max chars=50
Resource object representing third_party_payment_method.
always returned
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
- 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.
Sample Request
curl https://{site}.chargebee.com/api/v2/payment_sources/pm___test__KyVnHhSBWSp1g42/delete \
-X POST \
-u {site_api_key}:
copy
curl https://{site}.chargebee.com/api/v2/payment_sources/pm___test__KyVnHhSBWSp1g42/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": 1517501369,
"deleted": false,
"excess_payments": 0,
"first_name": "Mark",
"id": "__test__KyVnHhSBWSosE41",
"last_name": "Henry",
"net_term_days": 0,
"object": "customer",
"pii_cleared": "active",
"preferred_currency_code": "USD",
"promotional_credits": 0,
"refundable_credits": 0,
"resource_version": 1517501370000,
"taxability": "taxable",
"unbilled_charges": 0,
"updated_at": 1517501370
},
"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": 1517501369,
"customer_id": "__test__KyVnHhSBWSosE41",
"deleted": true,
"gateway": "stripe",
"gateway_account_id": "gw___test__KyVnGlSBWSlFuCx",
"id": "pm___test__KyVnHhSBWSp1g42",
"issuing_country": "US",
"object": "payment_source",
"reference_id": "cus_I57FwgWWduCqaW/card_1HUx0fJv9j0DyntJohauwMHP",
"resource_version": 1517501369000,
"status": "valid",
"type": "card",
"updated_at": 1517501369
}
}
URL Format POST
https://{site}.chargebee.com/api/v2/payment_sources/{cust_payment_source_id}/delete
Resource object representing customer.
always returned
Resource object representing payment_source.
always returned
Deletes a payment method from Chargebee. Payment method in the payment gateway will not be affected.
Sample Request
curl https://{site}.chargebee.com/api/v2/payment_sources/pm___test__KyVnHhSBWSqeg4G/delete_local \
-X POST \
-u {site_api_key}:
copy
curl https://{site}.chargebee.com/api/v2/payment_sources/pm___test__KyVnHhSBWSqeg4G/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": 1517501375,
"deleted": false,
"excess_payments": 0,
"first_name": "Mark",
"id": "__test__KyVnHhSBWSqUW4F",
"last_name": "Henry",
"net_term_days": 0,
"object": "customer",
"pii_cleared": "active",
"preferred_currency_code": "USD",
"promotional_credits": 0,
"refundable_credits": 0,
"resource_version": 1517501375000,
"taxability": "taxable",
"unbilled_charges": 0,
"updated_at": 1517501375
},
"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": 1517501375,
"customer_id": "__test__KyVnHhSBWSqUW4F",
"deleted": true,
"gateway": "stripe",
"gateway_account_id": "gw___test__KyVnGlSBWSlFuCx",
"id": "pm___test__KyVnHhSBWSqeg4G",
"issuing_country": "US",
"object": "payment_source",
"reference_id": "cus_I57FH1UsPem3L6/card_1HUx0lJv9j0DyntJ5aukXV9f",
"resource_version": 1517501375000,
"status": "valid",
"type": "card",
"updated_at": 1517501375
}
}
URL Format POST
https://{site}.chargebee.com/api/v2/payment_sources/{cust_payment_source_id}/delete_local
Resource object representing customer.
always returned
Resource object representing payment_source.
always returned