How to accept payments in a React or Vue app from Pakistan

Short answer

To accept payments in a React or Vue app from Pakistan, use a Ruba checkout link and open it inside your page with the embedded checkout. You add one attribute to a button, load one script. Ruba takes the card, handles supported taxes and pays you to your own bank. You need no Stripe account.

You may not need a backend

Ruba has SDKs for TypeScript, Python, PHP and Go, and a plain checkout link needs no code at all. Hassan in Peshawar built a React app that cleans up CSV files. He is a front-end developer, and he does not want to build a billing server. Good news: a fixed product needs no backend at all. A reusable checkout link does the work.

Stripe does not support Pakistan, so most of the tutorials you find will not apply to you. This one does.

Three levels of depth

There are three ways. Start with the lightest one that does the job.

HTML triggerLightest
Works inAny page that accepts HTML
You addOne attribute and a script
ControlOpen only
Best forLanding pages

Great for A button that opens checkout on top of your page.

Watch for You cannot react to events in code.

Figure 1From Ruba’s embedded checkout docs.

The lightest way: HTML

Copy your product’s checkout link from the dashboard. Put it in this snippet on any page that accepts HTML. In Vue, you can place it in a template or in your index file.

HTML
<a
  href="__CHECKOUT_LINK__"
  data-ruba-checkout
  data-ruba-checkout-theme="light"
>
  Purchase
</a>

<script
  defer
  data-auto-init
  src="https://cdn.jsdelivr.net/npm/@getruba/checkout@latest/dist/embed.global.js"
></script>
Figure 2From Ruba’s docs. Replace __CHECKOUT_LINK__ with your link.

React, with the package

Install @getruba/checkout, then call RubaEmbedCheckout.init() once after the component mounts. It attaches to the same data-ruba-checkout attribute.

PurchaseLink.tsx
import { RubaEmbedCheckout } from '@getruba/checkout/embed'
import { useEffect } from 'react'

export function PurchaseLink() {
  useEffect(() => {
    RubaEmbedCheckout.init()
  }, [])

  return (
    <a href="__CHECKOUT_LINK__" data-ruba-checkout>
      Purchase
    </a>
  )
}
Figure 3Adapted from Ruba’s docs.

If you need to open it from your own code, use create(). It resolves when the iframe is ready.

TypeScript
const checkout = await RubaEmbedCheckout.create('__CHECKOUT_LINK__', {
  theme: 'light',
  onLoaded: () => console.log('Checkout is ready'),
})
Figure 4Adapted from Ruba’s docs. The instance emits loaded, close, confirmed and success.

Do not trust the browser alone

Use the browser for
Opening checkout
Showing a thank-you message
Analytics events
Use your server for
Unlocking paid features
Recording that a user paid
Anything a user could fake
Figure 5A general rule for any payment flow.

For the server side, see the Next.js guide.

What to do next

Apply for Ruba early access, create a product and copy its checkout link. Ruba charges 4% + $0.50 per sale, with no monthly fee, and pays individuals in Pakistan in PKR to their own bank. A payout costs $2 up to $200, then 1%, and starts at $10 after the fee.

A checkout link can sit in any front end. No monthly bill, and no company to register before your first sale. Get approved in early access and your React or Vue app keeps 4% + $0.50 per sale, locked while the account stays open and in good standing. The $100 promise: a fee Ruba never told you about comes back to you, and Ruba pays you $100. Terms apply. See the early-access deal.

Questions people ask

Do I need a backend to accept payments in a React app?

Not for a fixed product. A reusable checkout link needs no backend, and the embed opens it inside your page. If you need customer-specific values, create a Checkout Session from your server instead.

Does it work in Vue?

An HTML trigger works on any page that accepts HTML, and there is an example for React. The HTML trigger with the global script works in any framework’s template. Test the package init in your own setup.

How do I know when the payment succeeded?

The embed emits four events: loaded, close, confirmed and success. For anything that matters, such as unlocking access, trust your server and webhooks, not only the browser.

What about the iframe origin?

For a dynamically created session, set embed_origin to the exact origin that hosts the iframe, for example https://example.com.

Do I need Stripe keys in my app?

No. Your app only uses Ruba’s checkout link or API. Ruba is the Merchant of Record and pays you to your own bank.

Sources

We check these when we update this guide. Rules can change, so check them yourself before you decide.

A note from FaizanHi, I’m Faizan, the founder of Ruba. I built it so people anywhere, from Pakistan, India and Bangladesh to the UK, the EU and the US, can sell software to the world and get paid at home.I wrote these guides to be as fair as I can. But I built Ruba, so I’m about as neutral as a parent at a school play. That’s why every fact has a source you can check.
Early access is live.

Sellers approved now keep 4% + $0.50 per sale locked for as long as they sell, plus +$100 if we ever charge a fee we never told you about. No company and no monthly fee. You are paid to a bank in your own name, in PKR, INR, BDT or 51 other currencies, whenever you ask, from $10. A payout costs $2 up to $200.

Applying is not approval. Terms apply.
All guides

Can’t find your country or currency? Email support@getruba.com.

This guide is general information, not legal, tax or financial advice. Other companies named here set their own rules, which can change. Check their websites before you decide.