POST
Buyer purchases a single marketplace listing

Authorizations

X-InStockRx-Api-Key
string
header
required

Scoped partner API key. Send the whole key, e.g. ik_live_a1b2c3…, on every request.

Headers

X-Pharmacy-Id
string<uuid>

Which pharmacy in your group you are acting as. Required whenever your group holds more than one pharmacy — omitting it is then 400 missing-pharmacy-context. With exactly one pharmacy it may be omitted, but send it anyway: the call starts failing the day a second pharmacy is added.

Idempotency-Key
string

Makes this request safe to retry. A retry carrying the same key replays the original response rather than acting twice, and is marked X-Idempotent-Replay: true. The same key with a different body is 409. Records are kept for 24 hours.

Required string length: 1 - 255
If-Match
string

The ETag from your most recent read of this resource, to avoid overwriting a change someone else made in the meantime. A stale value is 412 stale-resource and nothing is modified. * means "any current version". Omitting it is not an error — it means last write wins.

Examples:

"W/\"AAAAAAAAB9E=\""

"*"

Path Parameters

id
string<uuid>
required

Body

application/json

Body for POST /marketplace-listings/{id}/purchase. Pair with If-Match (ETag from a recent GET on the listing) to guard against concurrent edits — mismatch returns 412 Precondition Failed.

paymentMethod
object
required

Tagged reference to a stored payment method. Today only type = Dwolla is accepted on purchase calls. Forward-compatible: if a new rail is added in a future minor revision, partners that hardcode Dwolla will keep working; partners that surface the rail to their users can add it without an SDK upgrade.

bundleId
string<uuid>

Join an existing Pending bundle from the same seller. Omit to let the system create a new bundle. If supplied and the bundle would exceed the cold-chain cap, the server returns 409 bundle-full-cold-chain (the partner may retry without bundleId to land in a fresh bundle).

shippingSelection
EasyPost-managed · object

Exactly one shape must be supplied. EasyPost-managed uses a rateId from a prior shipping-rates call; manual lets the buyer supply their own carrier and tracking number.

shipByDate
string<date>

Buyer's requested ship-by date. Must be in the future.

buyersMessage
string
Maximum string length: 500
referralCode
string
Maximum string length: 64

Response

OK — listing is now Purchased; response includes the listing and the bundle it landed in.

listing
object
required
bundle
object
required