By Hanzalah Seikhai, payment integration developer. 3 December 2026
Integrating Square, Authorize.Net, Braintree or any payment gateway: the parts that matter
Every gateway has its own SDK and names, but the parts that break are the same. This is the checklist I use for Square, Authorize.Net, Braintree, Razorpay, Adyen, PayPal and local gateways with only an API.
1. Tokenise in the browser, charge on the server
Card details go to the gateway's own fields or hosted page, which return a token or nonce. Square has the Web Payments SDK, Authorize.Net has Accept.js, Braintree has Drop-in and Hosted Fields. Your server charges with that token and your secret credentials. Raw card numbers should never touch your server.
2. Confirm on the server and store the gateway id
Mark the order paid only after your server gets a successful response, and save the gateway's transaction id on the order. That id is what you need for refunds, disputes and support.
3. Listen for webhooks
Authorize.Net has webhooks with a signature key, Square signs its webhooks with a signature key per subscription, Braintree sends signed notifications, Razorpay signs with a webhook secret. Verify the signature on the raw body, then handle captures, refunds, voids and chargebacks so your app matches what the gateway sees.
4. Idempotency
Network timeouts make apps retry. Square and Razorpay accept idempotency keys, Braintree and Authorize.Net let you check for an existing transaction first. Make sure a retry can never charge twice.
5. Sandbox, then one real payment
Every gateway has a sandbox with separate credentials. Test success, decline, refund and the webhook, then run one small live payment and refund it before launch.
Gateways with no plugin
For local providers with only API documentation, I read the docs, build the payment and callback flow, and test it in their sandbox before it goes near real customers.
If you want this fixed or built in your app, see Custom payment gateway API, hire me on Upwork, or get in touch.
Written by Hanzalah Seikhai, Stripe developer. Hire me on Upwork.