Connect Stripe to FazerCards for Automated Gift Card Sales
Most resellers spend their first months doing work that should not require a human: confirm the payment, log into the supplier panel, place the order, copy the code, email it to the buyer. Every step is manual friction and a ceiling on throughput. Stripe Checkout and the FazerCards REST API are designed to eliminate exactly this — one collects and processes payment, the other fulfills the order in seconds. Wire them together and the buyer receives their gift card code before they finish reading the confirmation page.
Before You Build
You need an active FazerCards account with an API key from your dashboard. The free 5-day Gold trial gives full API access on the live catalog — no card required, real orders from the first minute. On the Stripe side, check eligibility before you write any code. Stripe's list of restricted businesses places third-party gift cards, preloaded cards and the sale of in-game currency under "Nonfiat currency and stored value" — categories that need additional due diligence and that Stripe may decline. Describe exactly what you sell when you apply, and wait for written confirmation before going live: processing a restricted category without approval puts the account, and the funds in it, at risk. Once you are approved, a standard account with webhooks enabled is all the integration needs.
Decide upfront which product type you are selling. FazerCards exposes separate catalog endpoints and order endpoints for gift cards, top-ups, and game keys. This guide covers gift cards end to end — the pattern around POST /giftcards/order — but the idempotency and webhook-handling logic carry directly to POST /topups/order and POST /gamekeys/order without change.
You can call the FazerCards API from any language with an HTTP client. Official packages exist for Python (install the fazercards package via pip) and for Node (install fazercards via npm) if you prefer a higher-level wrapper.
Step 1: Map Your Gift Cards to Stripe Products
In the Stripe dashboard, create one Product for each gift card category you intend to sell — PlayStation, Google Play, Roblox, whatever your catalog includes. Under each Product, create one Price per denomination range. Store the FazerCards category_id and card_id that correspond to that denomination in each Price’s metadata object. When a buyer completes checkout, Stripe carries this metadata to your webhook handler, so your fulfillment code always knows what to order without additional lookups.
Before activating any Price, check the stock field in the response from GET /giftcards/cards with the appropriate category_id as the query parameter. Listing a card that is currently out of stock creates refund pressure and a poor buyer experience. Run this stock check on a scheduled basis and automatically deactivate Stripe Prices whose underlying card_id shows zero stock.
Step 2: Create the Checkout Session
When a buyer selects a denomination on your site, your server calls Stripe’s checkout session API. Two parameters deserve special attention:
- Set client_reference_id to a UUID you generate per transaction. You will pass this to FazerCards as an idempotency key, ensuring that Stripe webhook retries do not create duplicate orders.
- Include the buyer’s email via customer_email or a Stripe Customer ID. You need it at delivery time.
Redirect the buyer to the session URL Stripe returns. Stripe handles card collection, 3-D Secure authentication, and regional payment methods — you never touch raw card data.
Step 3: Verify the Incoming Stripe Webhook
Point a Stripe webhook at a /webhooks/stripe endpoint on your server and subscribe to checkout.session.completed. When Stripe posts to this endpoint, the very first action in your handler must be signature verification: check the Stripe-Signature header against your webhook signing secret. Reject anything that fails without processing it. A forged event that bypasses this check would trigger a real FazerCards order at real cost.
After verification, extract the session’s line items (use Stripe’s expand parameter or a secondary API call). The metadata from Step 1 gives you category_id and card_id. The client_reference_id from Step 2 is your idempotency key.
Step 4: Place the FazerCards Order
Call the FazerCards API with POST /giftcards/order. Authenticate with the X-Api-Key header and add the Idempotency-Key header set to the client_reference_id from Step 3. FazerCards stores idempotency keys for seven days — longer than Stripe’s retry window — so repeated calls with the same key return the original order instead of re-charging your balance.
Two outcomes are possible. If the product delivers instantly, the response arrives with status completed and the codes are already in the order's cards field. If the status is processing, the code has not yet been assigned; it arrives via a FazerCards webhook event named order.status_changed when the order completes. Fetch the code with GET /orders/:orderId after that event.
Step 5: Get the Code to the Buyer
Once you have the code, deliver it. Email is the safest channel: send a transactional message with the code, the order ID, and redemption instructions. Display it on the post-payment page too if your store architecture allows it.
Log every delivery with both the FazerCards order_id and the Stripe payment_intent ID side by side. This is your evidence trail: when a buyer reports a non-working code, open a support case with FazerCards including the order ID. Verified redemption failures receive a replacement code or a credit to your balance.
Step 6: Handle Orders That Fail
When a FazerCards order returns status failed, you have a clear choice: place a fresh order with a new Idempotency-Key — reusing the old key would simply return the failed order — or issue a Stripe refund programmatically via the payment intent’s refund endpoint. Do not leave a buyer without one or the other.
For disputes — a buyer receives a code that does not redeem at the issuer — the path is the same: the buyer contacts you, you contact FazerCards with the order ID, and verified cases receive a replacement or a balance credit. Document this process in your store’s support section. Clear expectations reduce chargebacks and build trust.
Details on the FazerCards webhook retry schedule — three attempts at 1, 5, and 30 minutes after a failed delivery — are in the API cookbook.
What You End Up With
A buyer lands on your product page, selects a denomination, pays through Stripe’s hosted checkout, and receives a working gift card code — typically within seconds of the charge clearing. You handle no card data, place no manual orders, and maintain a complete audit trail from Stripe payment to FazerCards order ID to buyer delivery timestamp. The flow scales from dozens of daily transactions to thousands without any additional manual work.
Browse the full gift card catalog, review pricing plans to find the discount tier that suits your projected volume, and launch with a free 5-day Gold trial — full API access, no card required, from the moment you sign up.
FAQ
Does this pattern work for top-ups, not just gift cards?
Yes. Swap POST /giftcards/order for POST /topups/order, which takes a category_id, an offer_id and a fields object carrying the player identifier, such as player_id. Collect that identifier from the buyer at checkout using Stripe’s custom fields parameter in the session. The webhook verification, idempotency key, and delivery logic are identical to the gift card flow. Note that Stripe's restricted list also covers in-game currency, so confirm top-ups are part of what Stripe approved.
What if my server is down and misses a Stripe webhook?
Stripe retries unacknowledged webhooks for up to 72 hours. Because every FazerCards order carries an Idempotency-Key equal to the Stripe session’s client_reference_id, any retry that reaches a recovered server will not duplicate the order or re-charge your balance. For added resilience, persist incoming webhook events to a local database table immediately on receipt and process from there — your server can replay the queue after any outage without risk.
Can I validate the integration before going live?
Stripe’s test mode sends real webhook events using test card numbers, so you can rehearse the full checkout and webhook flow without real buyer payments. While you do, point the handler at a stub or limit it to one low-value product: any FazerCards order it places is real. For the FazerCards side, the API runs on a single live environment — every order is a real order charged to your balance. Use the free 5-day Gold trial to place a handful of small real orders and confirm the end-to-end flow before switching Stripe to live mode.