Skip to main content

Quick Start

import { giftmeMakePayment, giftmeGetAuthCode, isMiniStoreContext } from 'mini-store-sdk';

if (!isMiniStoreContext()) {
console.warn('Not inside Giftme — falling back to standard checkout.');
// render your regular web checkout instead…
return;
}

/**
* 1. Ask the app for an OAuth code
* - returns a short-lived `authCode` that you can swap for a JWT
*/
const { authCode } = await giftmeGetAuthCode({ miniStoreId: 'ABC123' });
await fetch('/api/oauth/token', { method: 'POST', body: { authCode } });

/**
* 2. Kick off an in-app payment
*/
const paymentResult = await giftmeMakePayment({ orderToken: 'ORDER_XXXXXXXX' });
const { success, data } = paymentResult;