Apply manual or automatically discovered promo codes to reduce checkout costs with Rye’s Universal Checkout API.
This page explains how to use promo codes when submitting an order through the API. Rye supports two approaches: passing your own codes manually, and automatic promo code discovery.
With each order, you can include multiple promo codes to see if there are any applicable discounts. Our system will automatically check each code, and apply the first one that is valid.
Currently, we shuffle the provided promo codes and apply the first one that works. Coming soon, our system will automatically apply the promo code that gives the highest discount.
Promo codes are provided when creating a checkout intent as an array of strings within the promoCodes field, with each string representing a single code.
Set discoverPromoCodes: true when creating a checkout intent and Rye will automatically find and apply the best available promo code for the merchant. This is a cost optimization feature — Rye aggregates promo codes from multiple sources, caches them, and selects the code that gives the highest discount during offer retrieval, with no manual sourcing required on your end.
Include "discoverPromoCodes": true in your create checkout intent request.
During offer retrieval, Rye searches its aggregated promo code database for the merchant.
The best available code is applied automatically.
The applied code and discount amount appear in the offer response in the same appliedPromoCodes and discount.amountSubunits fields as manual codes.
You can use discoverPromoCodes together with manual promoCodes. Rye will merge discovered codes with any codes you provide and apply the best one available.