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.
{
"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
}
ChargeBee::PaymentSource
payment_source
. This is always the same as the business entity of the customer. 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.
require 'chargebee' ChargeBee.configure(:site => "{site}", :api_key => "{site_api_key}") result = ChargeBee::PaymentSource.create_using_temp_token({ :gateway_account_id => "gw___test__5SK2lMpwSRp4Mx02v", :customer_id => "__test__XpbTXGTSRp4QZ1EK", :type => "CARD", :tmp_token => "tok_1IVbmWJv9j0DyntJuLTiAhzK" }) customer = result.customer payment_source = result.payment_source
require 'chargebee' ChargeBee.configure(:site => "{site}", :api_key => "{site_api_key}") result = ChargeBee::PaymentSource.create_using_temp_token({ :gateway_account_id => "gw___test__5SK2lMpwSRp4Mx02v", :customer_id => "__test__XpbTXGTSRp4QZ1EK", :type => "CARD", :tmp_token => "tok_1IVbmWJv9j0DyntJuLTiAhzK" }) customer = result.customer payment_source = result.payment_source
ChargeBee::PaymentSource.create_using_temp_token({<param name> => <value>,<param name> => <value> ...})
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.fraud_session_id
: Your BlueSnap fraud session ID required to perform anti-fraud validation.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 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.
require 'chargebee' ChargeBee.configure(:site => "{site}", :api_key => "{site_api_key}") result = ChargeBee::PaymentSource.create_using_permanent_token({ :customer_id => "__test__XpbTXGTSRp4Q5TE9", :gateway_account_id => "gw___test__5SK2lMpwSRp4Mx02v", :reference_id => "cus_J7rVCB7oVNyDJF", :type => "CARD" }) customer = result.customer payment_source = result.payment_source
require 'chargebee' ChargeBee.configure(:site => "{site}", :api_key => "{site_api_key}") result = ChargeBee::PaymentSource.create_using_permanent_token({ :customer_id => "__test__XpbTXGTSRp4Q5TE9", :gateway_account_id => "gw___test__5SK2lMpwSRp4Mx02v", :reference_id => "cus_J7rVCB7oVNyDJF", :type => "CARD" }) customer = result.customer payment_source = result.payment_source
ChargeBee::PaymentSource.create_using_permanent_token({<param name> => <value>,<param name> => <value> ...})
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.
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
.
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.
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.fraud_session_id
: Your BlueSnap fraud session ID required to perform anti-fraud validation.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 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
). state_code
is provided. 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.
require 'chargebee' ChargeBee.configure(:site => "{site}", :api_key => "{site_api_key}") result = ChargeBee::PaymentSource.create_using_token({ :customer_id => "__test__XpbTXGTSRp4REKES", :token_id => "cb_tok___test__XpbTXGTSRp4RaBEV" }) customer = result.customer payment_source = result.payment_source
require 'chargebee' ChargeBee.configure(:site => "{site}", :api_key => "{site_api_key}") result = ChargeBee::PaymentSource.create_using_token({ :customer_id => "__test__XpbTXGTSRp4REKES", :token_id => "cb_tok___test__XpbTXGTSRp4RaBEV" }) customer = result.customer payment_source = result.payment_source
ChargeBee::PaymentSource.create_using_token({<param name> => <value>,<param name> => <value> ...})
require 'chargebee' ChargeBee.configure(:site => "{site}", :api_key => "{site_api_key}") result = ChargeBee::PaymentSource.create_using_payment_intent({ :customer_id => "__test__XpbTXGTSRp4MunE0", :payment_intent => { :gateway_account_id => "gw___test__5SK2lMpwSRp4Mx02v", :gw_token => "pi_1IVbmIJv9j0DyntJo1AUvK4o" } }) customer = result.customer payment_source = result.payment_source
require 'chargebee' ChargeBee.configure(:site => "{site}", :api_key => "{site_api_key}") result = ChargeBee::PaymentSource.create_using_payment_intent({ :customer_id => "__test__XpbTXGTSRp4MunE0", :payment_intent => { :gateway_account_id => "gw___test__5SK2lMpwSRp4Mx02v", :gw_token => "pi_1IVbmIJv9j0DyntJo1AUvK4o" } }) customer = result.customer payment_source = result.payment_source
ChargeBee::PaymentSource.create_using_payment_intent({<param name> => <value>,<param name> => <value> ...})
device_session_id
and fraud_merchant_id
as an input to fingerprint
. Here’s a sample to it. 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.fraud_session_id
: Your BlueSnap fraud session ID required to perform anti-fraud validation.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 require 'chargebee' ChargeBee.configure(:site => "{site}", :api_key => "{site_api_key}") result = ChargeBee::PaymentSource.create_voucher_payment_source({ :customer_id => "__test__XpbTXGTSRp4Mg0Dr", :voucher_payment_source => { :voucher_type => "BOLETO", :tax_id => "00000000000000", :gateway_account_id => "gw_161my9TXG5oNYwgv", :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"}' } }) customer = result.customer payment_source = result.payment_source
require 'chargebee' ChargeBee.configure(:site => "{site}", :api_key => "{site_api_key}") result = ChargeBee::PaymentSource.create_voucher_payment_source({ :customer_id => "__test__XpbTXGTSRp4Mg0Dr", :voucher_payment_source => { :voucher_type => "BOLETO", :tax_id => "00000000000000", :gateway_account_id => "gw_161my9TXG5oNYwgv", :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"}' } }) customer = result.customer payment_source = result.payment_source
ChargeBee::PaymentSource.create_voucher_payment_source({<param name> => <value>,<param name> => <value> ...})
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.require 'chargebee' ChargeBee.configure(:site => "{site}", :api_key => "{site_api_key}") result = ChargeBee::PaymentSource.create_card({ :customer_id => "__test__XpbTXGTSRp4Mg0Dr", :card => { :number => "378282246310005", :cvv => "100", :expiry_year => 2022, :expiry_month => 12 } }) customer = result.customer payment_source = result.payment_source
require 'chargebee' ChargeBee.configure(:site => "{site}", :api_key => "{site_api_key}") result = ChargeBee::PaymentSource.create_card({ :customer_id => "__test__XpbTXGTSRp4Mg0Dr", :card => { :number => "378282246310005", :cvv => "100", :expiry_year => 2022, :expiry_month => 12 } }) customer = result.customer payment_source = result.payment_source
ChargeBee::PaymentSource.create_card({<param name> => <value>,<param name> => <value> ...})
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
). state_code
is provided. 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.
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.fraud_session_id
: Your BlueSnap fraud session ID required to perform anti-fraud validation.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 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 , Authorize.Net, and GoCardless.
chargebee-request-origin-ip
) and the device information(chargebee-request-origin-device
). Once the bank account has been added, it needs to be verified.
SEPA is an initiative that integrates bank transfer payments denominated in euro. It is supported via GoCardless, Stripe and Adyen.
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.
chargebee-request-origin-ip
) and the device information(chargebee-request-origin-device
). 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.
chargebee-request-origin-ip
) and the device information(chargebee-request-origin-device
). require 'chargebee' ChargeBee.configure(:site => "{site}", :api_key => "{site_api_key}") result = ChargeBee::PaymentSource.create_bank_account({ :customer_id => "__test__XpbTXGTSRp4Ly9Dj", :bank_account => { :gateway_account_id => "gw___test__5SK2lMpwSRp4Ljs2t", :account_number => "000222222227", :routing_number => "110000000", :bank_name => "US Bank", :account_holder_type => "INDIVIDUAL", :account_type => "SAVINGS", :first_name => "Shay", :last_name => "Liam" } }) customer = result.customer payment_source = result.payment_source
require 'chargebee' ChargeBee.configure(:site => "{site}", :api_key => "{site_api_key}") result = ChargeBee::PaymentSource.create_bank_account({ :customer_id => "__test__XpbTXGTSRp4Ly9Dj", :bank_account => { :gateway_account_id => "gw___test__5SK2lMpwSRp4Ljs2t", :account_number => "000222222227", :routing_number => "110000000", :bank_name => "US Bank", :account_holder_type => "INDIVIDUAL", :account_type => "SAVINGS", :first_name => "Shay", :last_name => "Liam" } }) customer = result.customer payment_source = result.payment_source
ChargeBee::PaymentSource.create_bank_account({<param name> => <value>,<param name> => <value> ...})
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.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.
require 'chargebee' ChargeBee.configure(:site => "{site}", :api_key => "{site_api_key}") result = ChargeBee::PaymentSource.update_card("pm___test__XpbTXGTSRp4Xy9FR",{ :card => { :first_name => "John", :last_name => "Doe", :expiry_month => 5, :expiry_year => 2022, :billing_addr1 => "#678 Mission Street", :billing_city => "New York City", :billing_zip => "10002", :billing_state_code => "NY", :billing_country => "US" } }) customer = result.customer payment_source = result.payment_source
require 'chargebee' ChargeBee.configure(:site => "{site}", :api_key => "{site_api_key}") result = ChargeBee::PaymentSource.update_card("pm___test__XpbTXGTSRp4Xy9FR",{ :card => { :first_name => "John", :last_name => "Doe", :expiry_month => 5, :expiry_year => 2022, :billing_addr1 => "#678 Mission Street", :billing_city => "New York City", :billing_zip => "10002", :billing_state_code => "NY", :billing_country => "US" } }) customer = result.customer payment_source = result.payment_source
ChargeBee::PaymentSource.update_card(<cust_payment_source_id>,{<param name> => <value>,<param name> => <value> ...})
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.
The API is only supported for the payment_method
of type direct_debit
.
require 'chargebee' ChargeBee.configure(:site => "{site}", :api_key => "{site_api_key}") result = ChargeBee::PaymentSource.update_bank_account("pm___test__KyVnPbSerKGB5d",{ :bank_account => { :email => "johndoe@example.com", :first_name => "John", :last_name => "Doe" } }) customer = result.customer payment_source = result.payment_source
require 'chargebee' ChargeBee.configure(:site => "{site}", :api_key => "{site_api_key}") result = ChargeBee::PaymentSource.update_bank_account("pm___test__KyVnPbSerKGB5d",{ :bank_account => { :email => "johndoe@example.com", :first_name => "John", :last_name => "Doe" } }) customer = result.customer payment_source = result.payment_source
ChargeBee::PaymentSource.update_bank_account(<cust_payment_source_id>,{<param name> => <value>,<param name> => <value> ...})
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”.
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.
require 'chargebee' ChargeBee.configure(:site => "{site}", :api_key => "{site_api_key}") result = ChargeBee::PaymentSource.verify_bank_account("pm___test__XpbTXGTSRp4YjRFc",{ :amount1 => 32, :amount2 => 45 }) payment_source = result.payment_source
require 'chargebee' ChargeBee.configure(:site => "{site}", :api_key => "{site_api_key}") result = ChargeBee::PaymentSource.verify_bank_account("pm___test__XpbTXGTSRp4YjRFc",{ :amount1 => 32, :amount2 => 45 }) payment_source = result.payment_source
ChargeBee::PaymentSource.verify_bank_account(<cust_payment_source_id>,{<param name> => <value>,<param name> => <value> ...})
require 'chargebee' ChargeBee.configure(:site => "{site}", :api_key => "{site_api_key}") result = ChargeBee::PaymentSource.retrieve("pm___test__KyVmmpTSneqVht") payment_source = result.payment_source
require 'chargebee' ChargeBee.configure(:site => "{site}", :api_key => "{site_api_key}") result = ChargeBee::PaymentSource.retrieve("pm___test__KyVmmpTSneqVht") payment_source = result.payment_source
ChargeBee::PaymentSource.retrieve(<cust_payment_source_id>,{<param name> => <value>,<param name> => <value> ...})
require 'chargebee' ChargeBee.configure(:site => "{site}", :api_key => "{site_api_key}") list = ChargeBee::PaymentSource.list({ :limit => 3, "type[is]" => "card" }) list.each do |entry| payment_source = entry.payment_source end
require 'chargebee' ChargeBee.configure(:site => "{site}", :api_key => "{site_api_key}") list = ChargeBee::PaymentSource.list({ :limit => 3, "type[is]" => "card" }) list.each do |entry| payment_source = entry.payment_source end
ChargeBee::PaymentSource.list({<param name> => <value>,<param name> => <value> ...})
Switches the gateway in which this payment source information is stored.
This is applicable only if the payment source is present in Spreedly vault.
This operation does not support switching between Braintree and Stripe. If you need help using this API, contact support@chargebee.com.
require 'chargebee' ChargeBee.configure(:site => "{site}", :api_key => "{site_api_key}") result = ChargeBee::PaymentSource.switch_gateway_account("pm___test__XpbTXGTSRp4XbjFJ",{ :gateway_account_id => "gw___test__5SK2lMpwSRp4Wrl37" }) customer = result.customer payment_source = result.payment_source
require 'chargebee' ChargeBee.configure(:site => "{site}", :api_key => "{site_api_key}") result = ChargeBee::PaymentSource.switch_gateway_account("pm___test__XpbTXGTSRp4XbjFJ",{ :gateway_account_id => "gw___test__5SK2lMpwSRp4Wrl37" }) customer = result.customer payment_source = result.payment_source
ChargeBee::PaymentSource.switch_gateway_account(<cust_payment_source_id>,{<param name> => <value>,<param name> => <value> ...})
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.
This operation does not support copying of cards from Stripe and Braintree gateways. If you need help using this API, contact support@chargebee.com.
require 'chargebee' ChargeBee.configure(:site => "{site}", :api_key => "{site_api_key}") result = ChargeBee::PaymentSource.export_payment_source("pm___test__XpbTXGTSRp4TUQEq",{ :gateway_account_id => "gw___test__5SK2lMpwSRp4SXM2z" }) third_party_payment_method = result.third_party_payment_method
require 'chargebee' ChargeBee.configure(:site => "{site}", :api_key => "{site_api_key}") result = ChargeBee::PaymentSource.export_payment_source("pm___test__XpbTXGTSRp4TUQEq",{ :gateway_account_id => "gw___test__5SK2lMpwSRp4SXM2z" }) third_party_payment_method = result.third_party_payment_method
ChargeBee::PaymentSource.export_payment_source(<cust_payment_source_id>,{<param name> => <value>,<param name> => <value> ...})
Deletes a payment source. Once the payment source is deleted, if
Note: When multiple payment sources exist, the payment method added most recently will be considered.
If there is no such payment source present in the gateway for the customer, this API will return successfully without throwing any error.
require 'chargebee' ChargeBee.configure(:site => "{site}", :api_key => "{site_api_key}") result = ChargeBee::PaymentSource.delete("pm___test__XpbTXGTSRp4SEvEe") customer = result.customer payment_source = result.payment_source
require 'chargebee' ChargeBee.configure(:site => "{site}", :api_key => "{site_api_key}") result = ChargeBee::PaymentSource.delete("pm___test__XpbTXGTSRp4SEvEe") customer = result.customer payment_source = result.payment_source
ChargeBee::PaymentSource.delete(<cust_payment_source_id>,{<param name> => <value>,<param name> => <value> ...})
Deletes a payment method from Chargebee. Payment method in the payment gateway will not be affected.
require 'chargebee' ChargeBee.configure(:site => "{site}", :api_key => "{site_api_key}") result = ChargeBee::PaymentSource.delete_local("pm___test__XpbTXGTSRp4V0hEw") customer = result.customer payment_source = result.payment_source
require 'chargebee' ChargeBee.configure(:site => "{site}", :api_key => "{site_api_key}") result = ChargeBee::PaymentSource.delete_local("pm___test__XpbTXGTSRp4V0hEw") customer = result.customer payment_source = result.payment_source
ChargeBee::PaymentSource.delete_local(<cust_payment_source_id>,{<param name> => <value>,<param name> => <value> ...})