Skip to main content
Use this when your own system decides when to charge and how much: prescription refills, renewals on a schedule you run, or any later order the shopper has agreed to. The shopper pays once on Gale’s hosted checkout and agrees to later charges. Gale gives you a payment method id, and you charge it by API with the shopper absent. Gale keeps no schedule for these charges. If you want Gale to run the plan and the renewals, use Subscriptions.
Saved payment methods are switched on per merchant account. Ask your Gale contact to enable them for your test account before you start.

How it works

  1. Your server creates a checkout with setup_future_usage: "off_session".
  2. The shopper ticks a consent box on the hosted page and pays.
  3. Gale stores the card and returns a payment_method with an id that starts with pm_.
  4. Later, your server calls POST /api/v2/payment-methods/{id}/charges with the items and amounts for that order.
  5. Gale charges the card, creates an order, and sends order.completed.

Step 1: Ask for storage at checkout

Create the checkout as usual and add one field.
The response includes setup_future_usage: "off_session" and the checkout_url to send the shopper to.

Step 2: The shopper consents and pays

The hosted page shows a consent box for later charges. The shopper cannot pay until it is ticked. Gale records the consent with the payment.

Step 3: Receive the payment method

Once the card is stored, the same payment_method object appears in three places:
  • GET /api/v2/checkout/{id}
  • the order.completed webhook for that order
  • the payment_method.saved webhook
Store the id against your customer. Gale never returns the card number.

Step 4: Charge the card later

Send the items for this order. Amounts are integers in cents. An Idempotency-Key header of 22 to 255 characters is required. Use one key per order: the same key sent again returns the first result and never charges twice.
A successful charge returns 201 with the order.
Gale also sends order.completed with the same payment_method block. Fulfil from the webhook, as you do for a checkout.

When a charge does not go through

A decline looks like this:
Gale also sends payment.failed for a declined charge. Gale does not retry a declined charge for you. A charge is refused before the card is touched when:
  • the card was removed,
  • the card was stored without consent to later charges,
  • the order mixes eligible and non-eligible items,
  • an item in the order needs a Letter of Medical Necessity. The shopper has to complete that on the hosted checkout.

Manage stored cards

Remove a card when the shopper asks you to. A removed card cannot be charged again.

Refunds

Refund an order from a stored card the same way as any other order, with POST /api/v2/refunds.

Test and live

A card stored with a glm_test_ key can only be charged with a glm_test_ key, and the same holds for live. Use Gale’s test cards in test mode.

Limits

  • A card is stored only on a paid checkout.
  • To change a shopper’s card, create a new checkout with setup_future_usage and remove the old payment method.
  • One checkout stores one card.
  • A stored-card charge cannot mix eligible and non-eligible items, and cannot include an item that needs a Letter of Medical Necessity.

Reference