Checkout One-Time Payments
Use Chargebee to collect one-time payments from customers without creating a subscription.
This feature works well if your business provides:
- One-time services
- One-time services with subscription services
- Additional services or products for a limited time
Note
- One-time payment checkout works only with charges, ad hoc charges, and coupons. It does not work with plans or addons.
- You can add ad hoc charges only through the Hosted Pages API.
Prerequisites
Set up charges and coupons (as needed) in your Chargebee site.
Configure one-time payments
To enable checkout for one-time payments:
- Sign in to your Chargebee site.
- Go to Settings > Configure Chargebee > Checkout & Self Serve Portal.
- Select the Configuration tab, then select One time payments.
- Select Enable.
The following table describes the configuration settings for one-time payments:
| Setting | Description |
|---|---|
| Allow customers to access checkout via API only | Clear this option to let customers access checkout through the Drop-in script or Checkout URL. |
| Allow customers to add/remove coupons | Select this option to display coupons that customers can select or remove. |
| Allow customers to add multiple coupons | Select this option to let customers add multiple coupons. |
| Allow customers to remove products | Select this option to let customers remove products during checkout. |
| Save customer's payment method | Choose from these options:
|
| Add a redirect URL | Enter the URL where customers go after successful checkout, such as a thank you page or home page. |
The following screenshot shows how one-time payments appear in the checkout:
Integrate checkout one-time payments
Integrating checkout for one-time payments is similar to integrating checkout to your website or application, with a different format.
Use checkout URL
Use the following checkout URL format for one-time payments. Replace the site name and parameter values, then embed the URL directly in your website or application.
http://{your-Chargebee-site}.chargebee.com/hosted_pages/checkout?item_prices[item_price_id][0]=flat-price&item_prices[date_from][0]=1606724073&item_prices[date_to][0]=1612051200&item_prices[item_price_id][1]=per_unit-price&item_prices[quantity][1]=1&item_prices[date_from][1]=1606724073&item_prices[date_to][1]=1612051200&item_prices[item_price_id][2]=volume-price&item_prices[quantity][2]=2&item_prices[date_from][2]=1606724073&item_prices[date_to][2]=1612051200&item_prices[item_price_id][3]=stair-price&item_prices[quantity][3]=3&item_prices[date_from][3]=1606724073&item_prices[date_to][3]=1612051200&item_prices[item_price_id][4]=tiered-price&item_prices[quantity][4]=4&item_prices[date_from][4]=1606724073&item_prices[date_to][4]=1612051200&coupon_ids[0]=new_year_off&coupon_ids[1]=day_pass
To learn more about checkout URL integration, see Checkout integration.
Use drop-in script
Use the following drop-in script format for one-time payments. Replace the site name and parameter values, then embed the script directly in your website or application.
To learn more about drop-in script integration, see Checkout integration.
Note
The amount attribute is not supported. The price is automatically retrieved.
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
<script
src="https://js.chargebee.com/v2/chargebee.js"
data-cb-site="site-name"
></script>
</head>
<body>
<a
href="javascript:void(0)"
data-cb-type="checkout"
data-cb-addons_id_0="non-recurring-addon"
>subscribe</a>
<script>
document.addEventListener("DOMContentLoaded", function () {
const cbInstance = Chargebee.getInstance();
const link = document.querySelectorAll("[data-cb-type=checkout]")[0];
var product = cbInstance.getProduct(link);
// product.addCoupon("cbdemo_specialoffer");
});
</script>
</body>
</html>
Use Hosted Pages API
Use the Checkout one-time payments API to pass values for charges, ad hoc charges, and coupons. The API returns the checkout window.
Unsupported features
The following features are not currently supported in checkout for one-time payments:
- Cart abandonment
- Offline payment methods
- Checkout without payments
- Account hierarchy
Was this article helpful?