انتقل إلى المحتوى الرئيسي

New: the Landed Cost API quotes duties and taxes at checkout in 40 markets. About the Landed Cost API

International OrdersInternational Orders

Quickstart

Five steps from a new sandbox account to a paid test order. Code is illustrative.

  1. 1

    Create a sandbox account

    Sign up with your work email. The sandbox has every product and local method, and nothing in it moves real money.

    Create a sandbox account
  2. 2

    Get your test keys

    Copy your publishable key for the browser and your secret key for your server. Keep the secret key out of client code and version control.

    IO_PUBLISHABLE_KEY=pk_test_4f8Kx2...
    IO_SECRET_KEY=sk_test_51Hx9a...
  3. 3

    Create an order on your server

    An order holds the amount, currency, items and destination. We use it to pick methods, quote duties and route the payment.

    curl https://api.international-orders.com/v1/orders \
      -u $IO_SECRET_KEY: \
      -H "Content-Type: application/json" \
      -d '{"currency":"EUR","amount":12900,"shipping":{"country":"DE"}}'
  4. 4

    Render Checkout Components

    Mount the checkout with the order's client secret. It shows the right methods, language and duty-inclusive total for the shopper.

    <div id="checkout"></div>
    <script src="https://js.international-orders.com/v1"></script>
    <script>
      const io = InternationalOrders("pk_test_4f8Kx2...");
      io.checkout({ clientSecret }).mount("#checkout");
    </script>
  5. 5

    Handle the order.paid webhook

    Fulfil from the webhook, not the browser redirect. Verify the signature, respond quickly, and process the event idempotently.

    Browse every webhook event
    app.post("/webhooks", express.raw({ type: "application/json" }), (req, res) => {
      const event = io.webhooks.verify(req.body, req.header("IO-Signature")!, process.env.IO_WEBHOOK_SECRET!);
      if (event.type === "order.paid") fulfil(event.data.object.id);
      res.sendStatus(200);
    });

Ready for live keys?

Verify your business and switch your keys. Your integration doesn't change.