Upcharge

Coming soon. The Upcharge API, SDKs and MCP server aren't live yet. This is a preview of what we're building, and paths and fields may change. Leave your number for early access

SDKs and sandbox

Libraries for your server, card fields for any website, and a sandbox that follows the real state rules. Priya used the Node library and the card fields for her groomers' booking pages.

Get a sandbox keyQuickstart

Libraries for your server

Small, typed libraries that retry safely without charging twice. Need another language? Ask us.

Node and TypeScript

npm install @upcharge/sdk
Example
import Upcharge from "@upcharge/sdk";
const upcharge = new Upcharge(process.env.UPCHARGE_KEY);
const quote = await upcharge.surcharge.quote({ amount: 4200, paymentMethod: "pm_7Rk2Qx", merchantState: "TX" });

Python

pip install upcharge
Example
import upcharge
client = upcharge.Client(api_key=os.environ["UPCHARGE_KEY"])
quote = client.surcharge.quote(amount=4200, payment_method="pm_7Rk2Qx", merchant_state="TX")

Card fields you can put on any website

Card number, expiry and code fields that sit in an iframe on your page, so card numbers never touch your servers. When the customer finishes typing, you get a token and whether the card is credit or debit, so you know whether to show a surcharge. Then your server confirms the payment, or doesn't. It runs on our PCI DSS compliant platform, through our parent company Carpay.

card-fields.html
<script src="https://js.upchargepayments.com/v1/fields.js"></script>
<div id="card-fields"></div>
<script>
  const fields = Upcharge.fields({
    element: "#card-fields",
    publishableKey: "pk_test_...",
  });
  fields.on("complete", ({ token, cardType }) => {
    // token: "pm_7Rk2Qx", cardType: "credit"
    // send the token to your server and get a quote
  });
</script>

Cards to test with

These only work in the sandbox. Use any future expiry date and any 3-digit code. Try a credit card and then a debit card with the same Texas merchant, and you'll see the surcharge appear and disappear.

Card numberTypeWhat it does
4111 1111 1111 1111Visa creditApproved. Surcharge applies
5555 5555 5555 4444Mastercard creditApproved. Surcharge applies
4000 0000 0000 0002Visa debitApproved. Never surcharged
4000 0000 0000 0010Visa prepaidApproved. Never surcharged
4000 0000 0000 9995Visa creditDeclined: not enough funds
4000 0000 0000 0259Visa creditApproved, then disputed a day later

Sandbox card numbers are a preview and may change before general release.

Want a sandbox key to try these with?

Tell us what you're building. We'll send sandbox keys and put you in touch with an engineer.

Or try the calculator