Link wallet
Pay with a card from the person's Stripe Link wallet. They approve each purchase in Link, and Link issues a one-time card for that booking only.
Where it works
Send payment_collection: "link_wallet" on any v1 booking that takes a card, on a v1 flight, or on a v3 booking at commit. It works with live and test keys. Link's own limits apply: US and Canadian Link accounts only, and at most 500 USD per purchase.
After the person approves, the booking runs with Link's card and Link's billing address, exactly as it would with a card you sent. The venue's own steps still apply. For example, a restaurant can still text a code after the card goes in, so keep branching on next_action.type.
Before you start
- An Ophelia API key. Use a v1 key for v1 bookings and flights. For v3, the key needs the
v3:bookscope. - The person's Link access token. Run Link's sign-in with your own OAuth client and ask for the
payment_methods.agenticscope (Stripe: Link Agent Wallet). The token looks likeliwltoken_…. Ophelia never runs Link's sign-in and never keeps a refresh token, so you send a token on each booking. - At least 35 minutes left on the token. Link's access tokens last an hour, and the booking reads Link with the token for up to 32 minutes while it waits for the approval.
- A way to show the person a link, for Link's approval page.
Integrate on v1
1.Create the booking
Send payment_collection: "link_wallet" and link_wallet, and no card. The amount the person approves is also the one-time card's cap. Ophelia takes it from metadata.amount_cents (with metadata.currency, default usd), else the price the slot was offered at. A restaurant's card hold has no price, so send amount_cents there: the most the venue could charge under its terms, such as the no-show fee.
Ophelia asks Link for the person's approval before the booking row exists. If Link refuses, nothing is created and the call answers with the code (see Errors).
2.Send the person to Link
The booking comes back requires_action. next_action.urlis Link's approval page. Show it to the person. Nothing runs until they approve. If their Link settings approve the purchase on their own, the booking skips this step and runs at once.
The booking.requires_action webhook carries the same next_action, so you can send the link from a webhook handler.
3.Read the outcome
Link sends no callback to you. Ophelia reads the approval for you, so read GET /v1/bookings/{booking_id} every few seconds, or wait for the booking.confirmed and booking.failed webhooks. Once the person approves, the booking moves to processing and then on like any card booking. If they decline, or the approval lapses, it fails with a link_wallet_* code and nothing was attempted at the venue.
Cancelling a booking that is still waiting (POST /v1/bookings/{booking_id}/cancel) also cancels the request in Link, so the person can no longer approve it.
Flights
A flight takes the same two fields. The cap is the flight's max_total, and Link's 500 USD limit is the one flights meet most often: a max_total over it is refused before anything runs. Everything else is as on the Flights page.
Integrate on v3
On POST /v3/bookings, send payment_collection: "link_wallet" and link_wallet at max_commitment: "commit". authorize.max_total and authorize.currency are required on every vertical: they are the amount the person approves and the card's cap. Without them the call is 422 max_total_required.
The answer is 202 requires_action with challenge_type: "link_wallet_approval", pay_url (Link's approval page, for the person) and pay_expires_at. Nothing is driven until they approve. Read the outcome on GET /v3/bookings/{booking_id}. An abandon cancels the request in Link. See v3 payment for the rest of the order flow.
Timing and limits
next_action.expires_at (v1) or pay_expires_at (v3): Link's 30 minutes plus time for its last answer.On v3 the wait is held in memory: an Ophelia restart while the person has not yet approved ends the booking link_wallet_expired, with nothing attempted. On v1 the wait survives a restart.
Errors
field: link_wallet.access_token or field: link_wallet: the collection without a token, or a token without the collection.card_with_link_walletamount_requiredmetadata.amount_cents.max_total_requiredauthorize.max_total and authorize.currency.link_wallet_amount_over_limitlink_wallet_unauthorizedlink_wallet_errorlink_wallet_unavailablelink_wallet_declinedlink_wallet_expiredlink_wallet_action_requirederror_message says what. Start a new booking once it is resolved.link_wallet_canceledEvery link_wallet_* failure means nothing was attempted at the venue and nothing was charged. Once the card is in, failures are the ones any card booking can have, such as card_declined. See Errors for every code.
Testing
Send "test": true in link_walletto use Link's test mode: the approval screen is real, and the card it issues charges nothing. The token must come from a sign-in in Link's test mode.
"test": true.Security
The person's token can ask their wallet for cards, so keep it server side and send it only to Ophelia. Ophelia keeps it encrypted with the booking while the approval is pending, removes it when the card arrives, and never passes it to the browser that books. It is never logged or returned in a response. The one-time card is capped at the approved amount and good for this booking only.