POST /customers/{customer-id}/collect_payment

Note: This operation optionally supports 3DS verification flow. To achieve the same, create the Payment Intent and pass it as input parameter to this API.

This API can be used to collect the payments for customer's payment_due and not_paid invoices. You can either choose to collect the payment from an existing payment source or a new payment source. You can choose to either retain or discard the new payment source, which is being used for payment. If the amount collected exceeds the invoice amount, the surplus will be counted in as excess payments.

Servers

Path parameters

Name Type Required Description
customer-id String Yes

Request headers

Name Type Required Description
chargebee-request-origin-device String No

The device from which the customer has made the request

Content-Type String Yes The media type of the request body.

Default value: "application/x-www-form-urlencoded"

chargebee-event-webhook String No

skip only webhooks

Possible values:

  • "all-disabled"
chargebee-business-entity-id String No

If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation.

chargebee-event-actions String No

skip all actions to be done on the events

Possible values:

  • "all-disabled"
chargebee-request-origin-user String No

The email address of your customer/user. Use this when the email address has only ASCII characters.

chargebee-request-origin-ip String No

The IP address of the customer where the request originated

chargebee-request-origin-user-encoded String No

The Base64-encoded email address of your customer/user. Use this if the email address has UTF-8 characters. When this header is provided, the header chargebee-request-origin-user is ignored.

chargebee-event-email String No

skip only emails

Possible values:

  • "all-disabled"

Request body fields

Name Type Required Description
payment_initiator String No

The type of initiator to be used for the payment request triggered by this operation. * customer - Pass this value to indicate that the request is initiated by the customer * merchant - Pass this value to indicate that the request is initiated by the merchant

Possible values:

  • "merchant"
  • "customer"
invoice_allocations Object No

Parameters for invoice_allocations

invoice_allocations.invoice_id[] Array Yes

Identifier for the invoice. Multiple invoices can be passed.

invoice_allocations.allocation_amount[] Array No

Amount that will override the Invoice amount to be collected. If not specified Invoice amount to collect will be taken as default. The unit depends on the type of currency.

token_id String No

Token generated by Chargebee JS representing payment method details.

retain_payment_source Boolean No

Indicates whether the payment source should be retained for the customer.

Default value: false

payment_intent Object No

Parameters for payment_intent

payment_intent.id String No

Identifier for PaymentIntent generated by Chargebee.js. Applicable only when you are using Chargebee.js for completing the 3DS flow. The PaymentIntent should be in 'authorized' state while passing it here. You need not pass other PaymentIntent parameters if this is passed.

payment_intent.gateway_account_id String No

The gateway account used for performing the 3DS flow.

payment_intent.payment_method_type String No

The list of payment method types (For example, card, ideal, sofort, bancontact, etc.) this Payment Intent is allowed to use. If payment method type is empty, Card is taken as the default type for all gateways except Razorpay. * card - card * netbanking_emandates - netbanking_emandates * dotpay - dotpay * faster_payments - Faster Payments * upi - upi * direct_debit - direct_debit * sepa_instant_transfer - Sepa Instant Transfer * bancontact - bancontact * google_pay - google_pay * apple_pay - apple_pay * giropay - giropay * paypal_express_checkout - paypal_express_checkout * venmo - Venmo * klarna_pay_now - Klarna Pay Now * sofort - sofort * amazon_payments - Amazon Payments * ideal - ideal * pay_to - PayTo * boleto - boleto

Possible values:

  • "bancontact"
  • "upi"
  • "amazon_payments"
  • "online_banking_poland"
  • "direct_debit"
  • "sofort"
  • "boleto"
  • "netbanking_emandates"
  • "giropay"
  • "paypal_express_checkout"
  • "apple_pay"
  • "pay_to"
  • "venmo"
  • "payconiq_by_bancontact"
  • "card"
  • "klarna_pay_now"
  • "dotpay"
  • "faster_payments"
  • "sepa_instant_transfer"
  • "google_pay"
  • "ideal"
payment_intent.additional_information Object No

* `checkout_com`: While adding a new payment method using [permanent token](./payment_sources?#create_using_permanent_token) or passing raw card details to Checkout.com, `document` ID and `country_of_residence` are required to support payments through [dLocal](https://www.checkout.com/docs/previous/payments/payment-methods/cards/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](https://docs.checkout.com/resources/codes/country-codes). * `document`: Document ID is the user's [identification number](https://docs.dlocal.com/api-documentation/payins-api-reference/country-reference#documents) based on their country. * `bluesnap`: While passing raw card details to BlueSnap, if `fraud_session_id` is added, [additional validation](https://developers.bluesnap.com/docs/fraud-prevention) is performed to avoid fraudulent transactions. * `fraud`: Fraud identification related information. * `fraud_session_id`: Your [BlueSnap fraud session ID](https://developers.bluesnap.com/docs/fraud-prevention#section-implementing-device-data-collector) 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](https://developers.braintreepayments.com/guides/premium-fraud-management-tools/device-data-collection/javascript/v3#collecting-device-data) 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](https://developers.braintreepayments.com/guides/premium-fraud-management-tools/device-data-collection/javascript/v3#collecting-device-data) 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](https://developer.ebanx.com/docs/payments/guides/features/device-fingerprint#device-fingerprint) 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

payment_intent.gw_token String No

Identifier for 3DS transaction/verification object at the gateway. Can be passed only after successfully completing the 3DS flow. Refer 3DS implementation in Chargebee to find out the gateway-specific gw_token format. Applicable when you are using gateway APIs directly for completing the 3DS flow.

payment_intent.reference_id String No

Identifier for Braintree permanent token. Applicable when you are using Braintree APIs for completing the 3DS flow.

amount Integer No

Amount to be collected. If this parameter is not passed then the invoice(s) amount to collect will be collected.

payment_method Object No

Parameters for payment_method

payment_method.gateway_account_id String No

The gateway account in which this payment source is stored.

payment_method.type String No

The type of payment method. For more details refer Update payment method for a customer API under Customer resource. * sepa_instant_transfer - Payments made via Sepa Instant Transfer * direct_debit - Represents bank account for which the direct debit or ACH agreement/mandate is created. * bancontact - Payments made via Bancontact Card. * dotpay - Payments made via Dotpay. * automated_bank_transfer - Represents virtual bank account using which the payment will be done. * upi - UPI Payments. * google_pay - Payments made via Google Pay. * amazon_payments - Payments made via Amazon Payments. * paypal_express_checkout - Payments made via PayPal Express Checkout. * card - Card based payment including credit cards and debit cards. Details about the card can be obtained from the card resource. * ideal - Payments made via iDEAL. * sofort - Payments made via Sofort. * alipay - Payments made via Alipay.
This payment source is deprecated. * generic - Payments made via Generic Payment Method. * klarna_pay_now - Payments made via Klarna Pay Now * netbanking_emandates - Netbanking (eMandates) Payments. * apple_pay - Payments made via Apple Pay. * pay_to - Payments made via PayTo * unionpay - Payments made via UnionPay. * faster_payments - Payments made via Faster Payments * venmo - Payments made via Venmo * giropay - Payments made via giropay. * wechat_pay - Payments made via WeChat Pay.
This payment source is deprecated.

Possible values:

  • "upi"
  • "online_banking_poland"
  • "unionpay"
  • "direct_debit"
  • "netbanking_emandates"
  • "giropay"
  • "venmo"
  • "payconiq_by_bancontact"
  • "card"
  • "klarna_pay_now"
  • "faster_payments"
  • "sepa_instant_transfer"
  • "alipay"
  • "bancontact"
  • "amazon_payments"
  • "sofort"
  • "automated_bank_transfer"
  • "paypal_express_checkout"
  • "apple_pay"
  • "pay_to"
  • "generic"
  • "dotpay"
  • "google_pay"
  • "wechat_pay"
  • "ideal"
payment_method.tmp_token String No

Single-use token created by payment gateways. In Stripe, a single-use token is created for Apple Pay Wallet or card details. 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.

payment_method.additional_information Object No

* `checkout_com`: While adding a new payment method using [permanent token](./payment_sources?#create_using_permanent_token) or passing raw card details to Checkout.com, `document` ID and `country_of_residence` are required to support payments through [dLocal](https://www.checkout.com/docs/previous/payments/payment-methods/cards/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](https://docs.checkout.com/resources/codes/country-codes). * `document`: Document ID is the user's [identification number](https://docs.dlocal.com/api-documentation/payins-api-reference/country-reference#documents) based on their country. * `bluesnap`: While passing raw card details to BlueSnap, if `fraud_session_id` is added, [additional validation](https://developers.bluesnap.com/docs/fraud-prevention) is performed to avoid fraudulent transactions. * `fraud`: Fraud identification related information. * `fraud_session_id`: Your [BlueSnap fraud session ID](https://developers.bluesnap.com/docs/fraud-prevention#section-implementing-device-data-collector) 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](https://developers.braintreepayments.com/guides/premium-fraud-management-tools/device-data-collection/javascript/v3#collecting-device-data) 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](https://developers.braintreepayments.com/guides/premium-fraud-management-tools/device-data-collection/javascript/v3#collecting-device-data) 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](https://developer.ebanx.com/docs/payments/guides/features/device-fingerprint#device-fingerprint) 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

payment_method.reference_id String No

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.
For more details refer Update payment method for a customer API under Customer resource.

card Object No

Parameters for card

card.billing_addr2 String No

Address line 2, as available in card billing address.

card.billing_addr1 String No

Address line 1, as available in card billing address.

card.number String No

The credit card number without any format. If you are using Braintree.js, you can specify the Braintree encrypted card number here.

card.first_name String No

Cardholder's first name

card.expiry_month Integer No

Card expiry month.

card.additional_information Object No

* `checkout_com`: While adding a new payment method using [permanent token](./payment_sources?#create_using_permanent_token) or passing raw card details to Checkout.com, `document` ID and `country_of_residence` are required to support payments through [dLocal](https://www.checkout.com/docs/previous/payments/payment-methods/cards/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](https://docs.checkout.com/resources/codes/country-codes). * `document`: Document ID is the user's [identification number](https://docs.dlocal.com/api-documentation/payins-api-reference/country-reference#documents) based on their country. * `bluesnap`: While passing raw card details to BlueSnap, if `fraud_session_id` is added, [additional validation](https://developers.bluesnap.com/docs/fraud-prevention) is performed to avoid fraudulent transactions. * `fraud`: Fraud identification related information. * `fraud_session_id`: Your [BlueSnap fraud session ID](https://developers.bluesnap.com/docs/fraud-prevention#section-implementing-device-data-collector) 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](https://developers.braintreepayments.com/guides/premium-fraud-management-tools/device-data-collection/javascript/v3#collecting-device-data) 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](https://developers.braintreepayments.com/guides/premium-fraud-management-tools/device-data-collection/javascript/v3#collecting-device-data) 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](https://developer.ebanx.com/docs/payments/guides/features/device-fingerprint#device-fingerprint) and avoid fraudulent transactions. * `payer`: User related information. * `document`: Document is the user's identification number based on their country. * `fraud`: Fraud identification related information. * `device_session_id`: Session ID associated with the user's device

card.last_name String No

Cardholder's last name

card.gateway_account_id String No

The gateway account in which this payment source is stored.

card.billing_state_code String No

The ISO 3166-2 state/province code without the country prefix. Currently supported for USA, Canada and India. For instance, for Arizona (USA), set state_code as AZ (not US-AZ). For Tamil Nadu (India), set as TN (not IN-TN). For British Columbia (Canada), set as BC (not CA-BC).

card.billing_zip String No

Postal or Zip code, as available in card billing address.

card.expiry_year Integer No

Card expiry year.

card.cvv String No

The card verification value (CVV). If you are using Braintree.js, you can specify the Braintree encrypted CVV here.

card.billing_city String No

City, as available in card billing address.

card.billing_state String No

The state/province name. Is set by Chargebee automatically for US, Canada and India If state_code is provided.

card.preferred_scheme String No

The customer's preferred card scheme for co-branded cards.
Note: Currently, this parameter is only supported for Stripe. * cartes_bancaires - A Cartes Bancaires card scheme. * mastercard - A MasterCard scheme. * visa - A Visa card scheme.

Possible values:

  • "visa"
  • "cartes_bancaires"
  • "mastercard"
card.billing_country String No

The billing address country of the customer. Must be one of ISO 3166 alpha-2 country code.

Note : If you enter an invalid country code, the system will return an error.

Brexit

If you have enabled EU VAT in 2021 or later, or have manually enable the Brexit configuration, then XI (the code for United Kingdom -- Northern Ireland) is available as an option.

payment_source_id String No

Payment source used for the payment.

replace_primary_payment_source Boolean No

Indicates whether the primary payment source should be replaced with this payment source. In case of Create Subscription for Customer endpoint, the default value is True. Otherwise, the default value is False.

Default value: false

How to start integrating

  1. Add HTTP Task to your workflow definition.
  2. Search for the API you want to integrate with and click on the name.
    • This loads the API reference documentation and prepares the Http request settings.
  3. Click Test request to test run your request to the API and see the API's response.