The following table lists the Payment Sources API operations alongside the equivalent Card API operations:
{
"card_type": "american_express",
"created_at": 1517486946,
"customer_id": "__test__XpbTXGTSRp3ELNCY",
"expiry_month": 12,
"expiry_year": 2022,
"funding_type": "not_known",
"gateway": "chargebee",
"gateway_account_id": "gw___test__5SK2lMgOSRp3BOO1y",
"iin": "378282",
"last4": "0005",
"masked_number": "***********0005",
"object": "card",
"payment_source_id": "pm___test__XpbTXGTSRp3ENNCc",
"resource_version": 1517486946205,
"status": "valid",
"updated_at": 1517486946
}
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
). 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.
Retrieves the credit card for the customer id.
curl https://{site}.chargebee.com/api/v2/cards/__test__XpbTXGTSRp3ELNCY \ -u {site_api_key}:
curl https://{site}.chargebee.com/api/v2/cards/__test__XpbTXGTSRp3ELNCY \ -u {site_api_key}:
Adds or replaces card details of a customer. Updating card details replaces the present payment method.
Passing credit card details to this API involves PCI liability at your end as sensitive card info passes through your servers. If you wish to avoid that, you can use one of the following integration methodologies if applicable
billing_address
and vat_number
of the customer are deleted and replaced by the values passed with this request. Ensure that you pass the billing address parameters and the vat_number
parameters each time you make this request, to avoid losing the same information at the customer-level. billing_address
and vat_number
of the customer. curl https://{site}.chargebee.com/api/v2/customers/__test__XpbTXGTSRp3F3uCq/credit_card \ -u {site_api_key}:\ -d gateway_account_id="gw___test__5SK2lMgOSRp3BhV2u" \ -d first_name="Richard" \ -d last_name="Fox" \ -d number="4012888888881881" \ -d expiry_month=10 \ -d expiry_year=2022 \ -d cvv="999"
curl https://{site}.chargebee.com/api/v2/customers/__test__XpbTXGTSRp3F3uCq/credit_card \ -u {site_api_key}:\ -d gateway_account_id="gw___test__5SK2lMgOSRp3BhV2u" \ -d first_name="Richard" \ -d last_name="Fox" \ -d number="4012888888881881" \ -d expiry_month=10 \ -d expiry_year=2022 \ -d cvv="999"
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
). 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.
Switches the gateway in which customer’s card information is stored. This is applicable only if the payment method is card
.
Limitation
This request does not support switching between Braintree and Stripe payment gateways. Contact Chargebee Support to perform those actions.
curl https://{site}.chargebee.com/api/v2/customers/__test__XpbTXGTSRp3EldCh/switch_gateway \ -u {site_api_key}:\ -d gateway_account_id="gw___test__5SK2lMgOSRp3EaR32"
curl https://{site}.chargebee.com/api/v2/customers/__test__XpbTXGTSRp3EldCh/switch_gateway \ -u {site_api_key}:\ -d gateway_account_id="gw___test__5SK2lMgOSRp3EaR32"
Copies the customer’s card information to another payment gateway. This is useful if you want to port your customer’s card details to another gateway.
Limitation
This request does not support copying of cards between Braintree and Stripe payment gateways. Contact Chargebee Support to perform those actions.
curl https://{site}.chargebee.com/api/v2/customers/__test__XpbTXGTSRp3BmqCG/copy_card \ -u {site_api_key}:\ -d gateway_account_id="gw___test__5SK2lMgOSRp3BhV2u"
curl https://{site}.chargebee.com/api/v2/customers/__test__XpbTXGTSRp3BmqCG/copy_card \ -u {site_api_key}:\ -d gateway_account_id="gw___test__5SK2lMgOSRp3BhV2u"
Deletes the card for a customer. Upon successful deletion the auto_collection
attribute for the customer is set to off
and a card_deleted
event is triggered. If there is no card found at the gateway for the customer, this API returns without errors.
curl https://{site}.chargebee.com/api/v2/customers/__test__XpbTXGTSRp3DuPCO/delete_card \ -X POST \ -u {site_api_key}:
curl https://{site}.chargebee.com/api/v2/customers/__test__XpbTXGTSRp3DuPCO/delete_card \ -X POST \ -u {site_api_key}: