API Payment Link
Create payment links programmatically via API.
API Payment Link lets you create shareable payment links from your own system, your order management, your CRM, your invoicing tool, without logging into the Doitpay Merchant Dashboard. Instead of filling out a form, your system sends the payment details automatically. Doitpay generates the link, and you share it with your customer the same way you always do.
Think of it as the same Payment Link you already use in the dashboard, but triggered by your software instead of by hand.
Dashboard vs API Payment Link
| Dashboard Payment Link | API Payment Link | |
|---|---|---|
| How you create it | Fill in a form on the dashboard | Your system sends the details automatically |
| When to use it | Occasional, manual invoices | High volume, automated workflows |
| Who creates it | A person (you or your team) | Your software (order system, CRM, etc.) |
| What the customer sees | Exactly the same payment page | Exactly the same payment page |
| Link sharing | You copy and paste the link | Your system can send it automatically |
The customer experience is identical, they get a branded payment page, choose their payment method, and complete the payment. The only difference is how the payment link gets created: by a person in the dashboard, or by your system through the API.
When to Use API Payment Link
- You process many invoices daily and manual creation takes too much time
- You already have an order system (e-commerce, POS, booking platform) and want payment links generated automatically when orders come in
- You want to embed payment-link creation into your own invoice workflow
- You need to create payment links from third-party platforms (accounting software, WhatsApp Business API, etc.)
- You are a developer setting up automation for your team
How It Works
┌─────────────────┐
│ Your System │
│ (order/CRM/etc) │
└────────┬────────┘
│ ① Sends payment details
│ (merchant, customer, items, amount, expiry)
▼
┌─────────────────┐
│ Doitpay API │
│ │
│ • Validates │
│ • Creates link │
│ • Returns URL │
└────────┬────────┘
│ ② Returns payment link URL
▼
┌─────────────────┐
│ Your System │
│ │
│ • Stores link │
│ • Sends to │
│ customer │
└────────┬────────┘
│ ③ Customer opens link
▼
┌─────────────────┐
│ Customer │
│ │
│ • Sees amount │
│ • Chooses method│
│ • Pays │
└────────┬────────┘
│ ④ Payment confirmed
▼
┌─────────────────┐
│ Doitpay │
│ │
│ • Updates status│
│ • Notifies your │
│ system │
└─────────────────┘Step 1: Your system sends payment details. This includes which merchant, the invoice number, customer email, items being charged, the amount, currency, and how long the link should stay active.
Step 2: Doitpay returns the link. The response includes the shareable URL and a reference ID for tracking.
Step 3: Customer pays. Same experience as a dashboard-created link. They see the amount, choose their payment method (VA, QRIS, E-Wallet), and complete the payment.
Step 4: Doitpay notifies your system. When the customer pays (or the link expires), Doitpay can send a notification to your system so you can update your records automatically. No need to check the dashboard manually.
What You Get Back
Once your system sends the details, Doitpay returns:
- Payment URL: the link you share with the customer
- Reference ID: Doitpay's tracking number (useful if you need support)
- Status: starts as ACTIVE
- Summary: subtotal, tax, discount, additional fee, and total
Your system should save the payment URL and reference ID so you can track the payment later.
Payment Link Status
The same four statuses you see in the dashboard:
| Status | Meaning | What Happens |
|---|---|---|
| ACTIVE | Link is live, waiting for payment | Customer can still pay |
| PAID | Customer completed payment | Payment will be settled normally |
| EXPIRED | Link passed its expiry time | Customer can no longer pay; create a new link |
| CANCELLED | Link was manually cancelled | Customer can no longer pay; create a new link |
Your system can check the status at any time, or better yet, Doitpay can automatically notify your system when the status changes.
Getting Notified When a Customer Pays
Instead of having your system constantly check "has the customer paid yet?", Doitpay can send a notification to your system the moment a payment happens. This is called a webhook or callback.
Your developer sets up a URL on your system where Doitpay can send these notifications. When one of these events occurs, Doitpay sends the update:
| Event | When It Happens |
|---|---|
| Payment link created | A new link is generated |
| Payment received | Customer completed payment |
| Payment link expired | The link passed its expiry time |
| Payment link cancelled | The link was manually cancelled |
This is the same idea as getting an email when a customer pays, except it goes directly to your system so your records update automatically.
Managing API Payment Links
View All Links
Your system can fetch a list of all payment links, with the most recent first. You can filter by status (ACTIVE, PAID, EXPIRED, CANCELLED) and by date range.
Find a Specific Link
Your system can look up any payment link by its ID to check the latest status and details.
Cancel a Link
If you need to cancel a payment link before the customer pays, your system can do so. Only ACTIVE links can be cancelled. Once cancelled, the payment URL will no longer work.
What Your Customer Sees
Exactly the same experience as a dashboard-created Payment Link:
- They open the link and see the payment amount and description
- They choose their preferred payment method (VA, QRIS, E-Wallet)
- They complete the payment
- They receive confirmation when payment succeeds
- If you set a redirect URL, they are sent to that page after paying
The entire process is branded and secure, whether the link was created through the dashboard or the API.
Common Questions
Q: Is the customer experience different with API Payment Links?
No. The payment page looks and works exactly the same whether the link was created from the dashboard or the API.
Q: Can I edit a payment link after creating it through the API?
No, same as the dashboard. Payment links cannot be edited once created. Cancel the old one and create a new one with the correct details.
Q: How do I know when a customer pays?
Your system can receive automatic notifications (webhooks) from Doitpay. The status changes to PAID, and your system gets the update instantly.
Q: What if my system creates a duplicate by accident?
The API has a safety mechanism (idempotency) that prevents duplicate links from being created if the same request is sent twice. Your developer sets this up.
Q: What payment methods can my customer use?
The same methods enabled on your account, Virtual Account, QRIS, E-Wallet, and others.
Q: How long does a payment link stay active?
You decide. Set an expiry time when creating the link (e.g. 30 minutes, 24 hours). If you do not set one, the link stays active until paid or cancelled.
Q: Do I still need the dashboard if I use the API?
The dashboard is still useful for manual tasks, checking reports, and managing settings. The API handles the repetitive creation work; the dashboard remains your control centre.
Best Practices
- Use clear invoice numbers. Something like
INV-2026-0042is easier to search and reconcile later than a random string. - Add item details. The customer sees these on the payment page. Clear descriptions reduce confusion and disputes.
- Set an expiry time. Even if you do not think you need one, an expiry prevents stale links from floating around indefinitely.
- Use notifications, not manual checking. Set up webhooks so your system knows the moment a payment succeeds or a link expires.
- Save the reference ID. If you ever need to contact Doitpay support about a specific payment, the reference ID is what they will ask for.
- Test before going live. Doitpay provides a Sandbox environment where you can test the entire flow with test payments before using real money.
- Keep your API key secure. The API key is like a password for your system. Only share it with your developer and never put it in public-facing code.