purchaseProduct(product: EntityRef!, gift: ProductPurchaseGiftInput, buyer: BuyerInput, discountCode: String, giftCardCode: String, paymentMethod: ID, savePaymentMethod: Boolean, taxCalculationId: String, forRegistration: Boolean, recurringConsentAccepted: Boolean, emailMarketingConsent: Boolean, emailMarketingConsentDisclosureVersion: ID): PurchaseProductResult!Purchase a product (pass, membership, gift card, or physical product). Returns a checkout session if payment is required, or the purchase directly for free products.
Pass buyer when the caller is not signed in to perform guest checkout. Requires the business's guestCheckoutEnabled setting. Passes and memberships always require a signed-in user.
Arguments
productEntityRef!buyerBuyerInputdiscountCodeStringOptional discount code typed by the customer. Validated server-side against the product's business; an invalid or unmet code returns a per-field error rather than purchasing at full price.
giftCardCodeStringOptional gift-card code to apply against the product price. The card's remaining balance covers up to the post-discount line; any remainder is charged via Stripe.
paymentMethodIDExisting saved Stripe PaymentMethod to charge. Currently used for membership subscriptions so a signed-in buyer can subscribe without re-entering card details.
savePaymentMethodBooleanWhen true for a signed-in one-shot card checkout, attach the newly-entered card to the buyer's Stripe Customer for future purchases. Ignored for guest checkout and memberships.
taxCalculationIdStringStripe Tax calculation ID returned by a recent quoteTax query. When provided, the server reuses that calculation rather than computing a fresh one — guaranteeing the buyer is charged the amount they saw. Ignored when the seller has tax disabled.
forRegistrationBooleanSet when this purchase exists only to fund a registration that's being booked in the same flow (the buyer picked "buy a pass" as the payment method on a session). For a single-use pass the seat consumes the only session immediately, so the standalone purchase-confirmation email is suppressed — the registration confirmation already covers it. Multi-use passes still send the purchase email since sessions remain.
recurringConsentAcceptedBooleanSeparate affirmative consent for recurring membership charges. Required when purchasing a membership; ignored for one-time products.
emailMarketingConsentBooleanEmail-marketing opt-in captured at checkout. true records an affirmative consent for this buyer against the product's business; only honored when the business has consent collection enabled. Sessions never sends marketing email itself — consent lets the business email the participant through its own provider.
emailMarketingConsentDisclosureVersionIDVersion of the consent disclosure the buyer was shown. Frozen with the consent record so the proof reflects exactly what they agreed to.
Returns
See PurchaseProductResult for the full shape.
Try it
Example
mutation PurchaseProduct($product: EntityRef!, $gift: ProductPurchaseGiftInput, $buyer: BuyerInput, $discountCode: String, $giftCardCode: String, $paymentMethod: ID, $savePaymentMethod: Boolean, $taxCalculationId: String, $forRegistration: Boolean, $recurringConsentAccepted: Boolean, $emailMarketingConsent: Boolean, $emailMarketingConsentDisclosureVersion: ID) {
purchaseProduct(product: $product, gift: $gift, buyer: $buyer, discountCode: $discountCode, giftCardCode: $giftCardCode, paymentMethod: $paymentMethod, savePaymentMethod: $savePaymentMethod, taxCalculationId: $taxCalculationId, forRegistration: $forRegistration, recurringConsentAccepted: $recurringConsentAccepted, emailMarketingConsent: $emailMarketingConsent, emailMarketingConsentDisclosureVersion: $emailMarketingConsentDisclosureVersion) {
__typename
}
}
https://go.sessions.website/api/graphql