The Chargebee Webhook integration sends any events related to Customers, Charges, or Subscriptions. Partnerstack can then keep your customers in sync with Chargebee. It is the fastest and most accurate way to fully integrate with PartnerStack.
Get your Webhook URL
Navigate to Settings
> Integrations
> Webhooks
and select Chargebee
from the Supported integrations.
Click the copy
button to copy the URL to your clipboard.
Create the Webhook on the Chargebee Dashboard
Go to Settings
in the topbar, then in the API keys and webhooks
section selectWebhooks
and click the Add new Webhook
button. (or you can just go to
https://<yoursubdomain>.chargebee.com/webhooks/webhook#create
)
Add customer key to metaData
If you are not a developer, consider passing this off or have someone take a look at it after you are done.
Whenever you interact with Chargebee you need to let PartnerStack know which customer you are referring to.
PartnerStack looks for customer_key
in the metaData to identify customers. The same customer_key
you supplied in the call of growsumo.createSignup
needs to be attached to the metaData.
ADD `meta_data` containing the `customer_key`
MAKE SURE it matches the one used with GrowSumoJS
# chargebee.configure("test_2L7HV...", "your-site...")
# chargebee.Customer.create({
# "first_name" : "John",
# "last_name" : "Doe",
# "email" : "john@test.com",
"meta_data": {
"customer_key": <YOUR_CUSTOMERS_KEY>
}
# })
ADD `metadata` containing the `customer_key`
MAKE SURE it matches the one used with GrowSumoJS
# require 'chargebee'
# ChargeBee.configure(:site => "{site}", :api_key => "{site_api_key}")
# result = ChargeBee::Customer.create({
:meta_data => {"customer_key" => <YOUR_CUSTOMERS_KEY>),
# :first_name => "John",
# :last_name => "Doe",
# ...
# })
# customer = result.customer
# card = result.card
ADD `metadata` containing the `customer_key`
MAKE SURE it matches the one used with GrowSumoJS
<?
// require 'ChargeBee.php';
// ChargeBee_Environment::configure("{site}","{site_api_key}");
// $result = ChargeBee_Customer::create(array(
// "firstName" => "John",
// "lastName" => "Doe",
"metaData" => array("customer_key" => <YOUR_CUSTOMERS_KEY>)
// ...
// ));
// $customer = $result->customer();
// $card = $result->card();
ADD `metadata` containing the `customer_key`
MAKE SURE it matches the one used with GrowSumoJS
// Environment.configure("{site}","{site_api_key}");
// Result result = Customer.create()
// .firstName("John")
// .lastName("Doe")
.metaData("customer_key", <YOUR_CUSTOMERS_KEY>)
// ...
// Customer customer = result.customer();
// Card card = result.card();
ADD `metadata` containing the `customer_key`
MAKE SURE it matches the one used with GrowSumoJS
// var chargebee = require("chargebee");
// chargebee.configure({site : "{site}", api_key : "{site_api_key}"});
// chargebee.customer.create({
// first_name : "John",
// last_name : "Doe",
meta_data: { "customer_key": <YOUR_CUSTOMERS_KEY> },
// ..
// })
Depending on your integration with Chargebee your interaction with the metadata could be quite different. Here is a link to the Chargebee API Docs
Let us know if you have issues figuring out how to work with metaData and we will do our best to help out.
Chargebee Hosted Pages
For Chargebee Hosted Pages the customer_key must be passed as a Custom Field
It should be passed as cf_customer_id
.
The partner_key should also be passed as a Custom Field
cf_partner_key
Setup Subscription Plans
If you have any plans set up on Chargebee, now is the time to set them up on PartnerStack.
You need to make sure that the plan key on PartnerStack matches the plan id on Chargebee. You can find your plans on Chargebee by going to your dashboard and changing the path to https://<yoursubdomain>.chargebee.com/plans
.
Create all your plans in PartnerStack and you are good to go!
If you are not using PartnerStackJS, continue to the next section
Not using PartnerStackJS
You may not be using PartnerStackJS if you have a product that is purchased on signup, for example, an e-commerce store.
If you are not using PartnerstackJS, you must attach the customer key as account_code and the partner key as the username in your Create Customer calls.
This lets PartnerStack know which partner is responsible for which customer. After the customer has been created you can reference the customers with their key.