De cero a una tarjeta Amazon MX canjeada en tres pasos.
curl https://droprails.mx/api/v1/catalog?brand=amazon-mexico
# → { items: [
# { sku: "amazon-mexico-300", amount: 30000, currency: "MXN", ... },
# ...
# ] }Elige una vía. Cada una tiene su formato de credencial. El camino más simple es el cliente TypeScript de mppx:
import { Mppx, tempo } from 'mppx'
const mppx = Mppx.create({
methods: [tempo.charge({ account: privateKeyAccount('0x...') })]
})
// mppx auto-handles the 402 → credential → 200 dance.
const res = await mppx.fetch('https://droprails.mx/api/v1/buy', {
method: 'POST',
headers: {
'Idempotency-Key': crypto.randomUUID(),
'Content-Type': 'application/json',
},
body: JSON.stringify({ sku: 'amazon-mexico-300' })
})
const receipt = await res.json()
console.log(receipt.redemption.value) // → "249032"Flujo manual de dos pasos si quieres ver el protocolo en la red:
# 1. First call returns 402 with a challenge.
curl -X POST https://droprails.mx/api/v1/buy \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{"sku":"amazon-mexico-300"}'
# < HTTP/1.1 402 Payment Required
# < WWW-Authenticate: Payment id="...", method="tempo", ...
# 2. Settle on Tempo, then re-send with the credential.
curl -X POST https://droprails.mx/api/v1/buy \
-H "Idempotency-Key: $(uuidgen)" \
-H "Authorization: Payment <credential>" \
-H "Content-Type: application/json" \
-d '{"sku":"amazon-mexico-300"}'
# < HTTP/1.1 200 OK
# < Payment-Receipt: eyJ...
# { "order_id": "01HZ...", "redemption": { "type": "text", "value": "249032", ... } }- › POST/api/v1/buy
- › explora el catálogo en
/catalog - › guías por vía → tempo, solana, stripe-spt