Adding or updating payment method information to Chargebee depends on the type of payment method and also the type of payment page used. If you have custom payment pages - hosted at your end, depending on the type of payment method (Card, PayPal, Amazon, Direct debit via ACH), information can be pushed to Chargebee via API. This would be the case in the following scenarios:
If you have custom payment pages hosted at your end, card information can be passed to Chargebee while performing the following API operations:
If you use Stripe.js to host your payment pages, after customer fills in the card information during checkout or card update, the card information is directly sent to Stripe. Stripe then returns a temporary token to identify the particular card's information. This temporary token has to be pushed to Chargebee in the form of the parameter card[tmp_token]. The following API operations can be used to add/update card information in such cases:
The customer information (First name, last name, etc.) is obtained directly from Stripe in this scenario. Even if you try passing the information. directly to Chargebee, the customer information present at Stripe is considered.
If you have directly integrated with PayPal Express Checkout (Reference Transactions) or Pay with Amazon (Login & Pay with Amazon) on your website, when customers add/update their payment method, a Billing Agreement ID is generated. This Billing Agreement ID has to be pushed to Chargebee by specifying the payment method[type] and payment method[reference_id] parameters. The following API operations can be used to add/update payment method information in such cases:
At any given time, only one of the given three scenarios is possible for defining a payment method for a customer.
For example, if you try to pass card[tmp_token] (Scenario 2) and the card[number] parameter while creating a customer, this would result in an error.
If you have to update the card information partially, use the following API operation.