Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

webhook-events-for-the-github-marketplace-api.md 5.0 KB

You have to be logged in to leave a comment. Sign In
title intro redirect_from versions
Webhook events for the GitHub Marketplace API A {% data variables.product.prodname_marketplace %} app receives information about changes to a user's plan from the Marketplace purchase event webhook. A Marketplace purchase event is triggered when a user purchases, cancels, or changes their payment plan. [/apps/marketplace/setting-up-github-marketplace-webhooks/about-webhook-payloads-for-a-github-marketplace-listing/ /apps/marketplace/integrating-with-the-github-marketplace-api/github-marketplace-webhook-events/ /marketplace/integrating-with-the-github-marketplace-api/github-marketplace-webhook-events] [{free-pro-team *}]

{% data variables.product.prodname_marketplace %} purchase webhook payload

Webhooks POST requests have special headers. See "Webhook delivery headers" for more details. GitHub doesn't resend failed delivery attempts. Ensure your app can receive all webhook payloads sent by GitHub.

Cancellations and downgrades take effect on the first day of the next billing cycle. Events for downgrades and cancellations are sent when the new plan takes effect at the beginning of the next billing cycle. Events for new purchases and upgrades begin immediately. Use the effective_date in the webhook payload to determine when a change will begin.

{% data reusables.marketplace.marketplace-malicious-behavior %}

Each marketplace_purchase webhook payload will have the following information:

Key Type Description
action string The action performed to generate the webhook. Can be purchased, cancelled, pending_change, pending_change_cancelled, or changed. For more information, see the example webhook payloads below. Note: The pending_change and pending_change_cancelled payloads contain the same keys as shown in the changed payload example.
effective_date string The date the action becomes effective.
sender object The person who took the action that triggered the webhook.
marketplace_purchase object The {% data variables.product.prodname_marketplace %} purchase information.

The marketplace_purchase object has the following keys:

Key Type Description
account object The organization or user account associated with the subscription. Organization accounts will include organization_billing_email, which is the organization's administrative email address. To find email addresses for personal accounts, you can use the Get the authenticated user endpoint.
billing_cycle string Can be yearly or monthly. When the account owner has a free GitHub plan and has purchased a free {% data variables.product.prodname_marketplace %} plan, billing_cycle will be nil.
unit_count integer Number of units purchased.
on_free_trial boolean true when the account is on a free trial.
free_trial_ends_on string The date the free trial will expire.
next_billing_date string The date that the next billing cycle will start. When the account owner has a free GitHub.com plan and has purchased a free {% data variables.product.prodname_marketplace %} plan, next_billing_date will be nil.
plan object The plan purchased by the user or organization.

The plan object has the following keys:

Key Type Description
id integer The unique identifier for this plan.
name string The plan's name.
description string This plan's description.
monthly_price_in_cents integer The monthly price of this plan in cents (US currency). For example, a listing that costs 10 US dollars per month will be 1000 cents.
yearly_price_in_cents integer The yearly price of this plan in cents (US currency). For example, a listing that costs 100 US dollars per month will be 10000 cents.
price_model string The pricing model for this listing. Can be one of flat-rate, per-unit, or free.
has_free_trial boolean true when this listing offers a free trial.
unit_name string The name of the unit. If the pricing model is not per-unit this will be nil.
bullet array of strings The names of the bullets set in the pricing plan.

Example webhook payload for a purchased event

This example provides the purchased event payload.

{{ webhookPayloadsForCurrentVersion.marketplace_purchase.purchased }}

Example webhook payload for a changed event

Changes in a plan include upgrades and downgrades. This example represents the changed,pending_change, and pending_change_cancelled event payloads. The action identifies which of these three events has occurred.

{{ webhookPayloadsForCurrentVersion.marketplace_purchase.changed }}

Example webhook payload for a cancelled event

{{ webhookPayloadsForCurrentVersion.marketplace_purchase.cancelled }}

Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...