AiCredits
Cross-Border Billing

How to Accept Alipay for AI API Payments Without a Chinese Bank Account

Accept Alipay for AI API credits without a Chinese bank: compare PSP, merchant-of-record and cross-border routes, plus a runnable credit-ledger pattern.

Published 2026-11-02 Updated 2026-11-02 9 min

The short answer: you never open an Alipay merchant account

Alipay's domestic merchant products — face-to-face QR, app pay, in-app mini-program payments — assume a mainland business licence, a Chinese corporate bank account, and usually an ICP filing. If your company is registered in the US, EU, UK, Singapore or Brazil and you sell API credits to developers, that door is closed and no amount of documentation will open it.

What is open is Alipay cross-border acquiring (and Alipay+ wallet acceptance). You contract with an overseas acquirer or payment service provider, not with Alipay directly. The PSP collects the payment from the buyer's Alipay wallet, handles the currency conversion and the China-side compliance, and settles to your bank, Payoneer or Wise account in your own currency. You never hold CNY and you never need a Chinese bank account — you need a PSP that has the corridor switched on.

Four routes that actually work

The right choice depends less on fees than on how much of the checkout you want to own. Availability varies by your registered country, business category and volume; confirm with each provider before you design around it.

RouteWho you contract withGood fitTradeoff
Global PSP with Alipay enabledStripe, Adyen, Checkout.com, Airwallex, dLocalYou already accept cards and want Alipay as one more method in the same dashboardApproval is manual and depends on your company country and business category
Merchant of recordPaddle, FastSpringDigital goods, no tax or compliance team, want someone else to be the sellerThey own the customer relationship and the refund; you get less control over local checkout
Cross-border specialistPingPong, LianLian, Oceanpayment, AsiaBillChina-facing audience, CNY price lists, higher share of Alipay buyersHeavier KYC paperwork, thinner developer docs, support across opposite time zones
Alipay+ wallet acceptanceAn Ant International partner or regional acquirerMobile-first, QR-driven checkout flowsWallet acceptance is not a subscription rail; recurring billing is limited

Design for prepaid credits, not invoices

Alipay is a push-payment method: the buyer approves a transfer in their app. There is no stored card to charge next month, and chargebacks behave differently from card rails. If you build a postpaid invoicing model — usage accrues all month, you bill at the end — you will spend your life chasing collections. Build a prepaid credit wallet instead: the buyer tops up, you credit the ledger, and every API call draws the wallet down.

A few rules that save weeks of support tickets:

  • Give every order a state machine — created, paid, credited, consumed — and store the gateway transaction id with a UNIQUE constraint so a replayed webhook can never double-credit.

  • Webhooks arrive twice, out of order, or after a timeout. Verify the signature, then make crediting idempotent rather than trying to make delivery reliable.

  • Treat 'paid but no credits' as your number one ticket category. It is almost always a handler that returned 200 before the database commit finished.

  • Expire promotional credits before paid credits, and make bonus credits non-refundable in your terms so partial refunds stay simple.

  • Show a local-currency estimate at checkout but record and settle in your own currency. The FX spread is a real cost — price it in, don't discover it.

The credit ledger your API actually reads

The ledger is the single source of truth for both billing and rate limiting. Below is a complete, runnable pattern: a top-up entry written by a PSP webhook, an idempotent credit, and an API call that meters itself from the response usage object.

import os, sqlite3, uuid
from openai import OpenAI

client = OpenAI(
    api_key=os.environ['AICREDITS_API_KEY'],
    base_url='https://api.aicreditsapi.com/v1',
)

db = sqlite3.connect('billing.db')
db.executescript(
    '''
    CREATE TABLE IF NOT EXISTS orders (
        order_id TEXT PRIMARY KEY,
        user_id  TEXT NOT NULL,
        credits  INTEGER NOT NULL,
        status   TEXT NOT NULL
    );
    CREATE TABLE IF NOT EXISTS ledger (
        id      INTEGER PRIMARY KEY AUTOINCREMENT,
        user_id TEXT NOT NULL,
        delta   INTEGER NOT NULL,
        reason  TEXT NOT NULL,
        ref     TEXT UNIQUE
    );
    '''
)

def create_order(user_id, credits):
    order_id = 'ord_' + uuid.uuid4().hex[:12]
    db.execute(
        'INSERT INTO orders (order_id, user_id, credits, status) VALUES (?, ?, ?, ?)',
        (order_id, user_id, credits, 'created'),
    )
    db.commit()
    return order_id

def mark_paid(order_id, provider_txn):
    # Call this from your Alipay / PSP webhook. Safe to call twice.
    row = db.execute(
        'SELECT user_id, credits FROM orders WHERE order_id = ?', (order_id,)
    ).fetchone()
    if row is None:
        return False
    user_id, credits = row
    try:
        db.execute(
            'INSERT INTO ledger (user_id, delta, reason, ref) VALUES (?, ?, ?, ?)',
            (user_id, credits, 'topup', provider_txn),
        )
        db.execute('UPDATE orders SET status = ? WHERE order_id = ?', ('credited', order_id))
        db.commit()
    except sqlite3.IntegrityError:
        return True  # already credited - idempotent no-op
    return True

def balance(user_id):
    return db.execute(
        'SELECT COALESCE(SUM(delta), 0) FROM ledger WHERE user_id = ?', (user_id,)
    ).fetchone()[0]

def chat(user_id, messages):
    if balance(user_id) <= 0:
        raise RuntimeError('out of credits - top up first')
    resp = client.chat.completions.create(
        model='deepseek-v4-flash',
        messages=messages,
    )
    db.execute(
        'INSERT INTO ledger (user_id, delta, reason, ref) VALUES (?, ?, ?, ?)',
        (user_id, -resp.usage.total_tokens, 'usage', 'chat_' + resp.id),
    )
    db.commit()
    return resp.choices[0].message.content

if __name__ == '__main__':
    uid = 'dev_42'
    order = create_order(uid, credits=100000)
    mark_paid(order, 'alipay_txn_abc123')
    mark_paid(order, 'alipay_txn_abc123')  # duplicate webhook: no double credit
    print('balance:', balance(uid))
    print(chat(uid, [{'role': 'user', 'content': 'Explain idempotency in one sentence.'}]))
    print('balance after:', balance(uid))

Note the shape of the metering: you do not estimate tokens in advance, you bill from usage the provider already counted. That removes a whole class of disputes. deepseek-v4-flash is the right default here — cheap enough that per-call metering granularity stays sane — while deepseek-v4-pro is worth reserving for requests that genuinely need more reasoning, since it costs more per call and makes small top-ups drain faster.

Triage the 'paid but no credits' tickets automatically

Failed Alipay payments generate support mail in several languages with gateway codes mixed in. Classify them before a human reads them, so refunds and escalations route correctly.

import json, os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ['AICREDITS_API_KEY'],
    base_url='https://api.aicreditsapi.com/v1',
)

SYSTEM = '''You triage failed Alipay payments for an AI API reseller.
Reply with JSON only, no markdown fences, exactly this shape:
{"category": "user_cancelled|insufficient_funds|kyc_required|network_or_timeout|currency_unsupported|duplicate_charge", "reply_en": "two sentences to the customer", "escalate": false}'''

def _loads(text):
    text = text.strip()
    if text.startswith('```'):
        text = text.split('\n', 1)[1].rsplit('```', 1)[0]
    return json.loads(text)

def triage(gateway_code, user_message):
    resp = client.chat.completions.create(
        model='deepseek-v4-flash',
        temperature=0,
        messages=[
            {'role': 'system', 'content': SYSTEM},
            {'role': 'user', 'content': 'gateway_code=' + gateway_code + '\nuser_message=' + user_message},
        ],
    )
    return _loads(resp.choices[0].message.content)

if __name__ == '__main__':
    print(triage('ACQ.TRADE_HAS_FINISHED', 'The money was taken but my credits never arrived'))

Run this inside your webhook consumer, not in the request path — the buyer's browser should get an immediate redirect, while the classification can take a second or two afterwards.

Compliance and reconciliation details that get accounts frozen

  • Describe your business as 'API credits for AI model access' everywhere in onboarding. A generic 'software services' description that does not match what the PSP sees on your site is the most common reason accounts get held.

  • Refunds must go back through the same channel and inside the gateway's refund window. Keep the original provider transaction id on the order row forever; without it, you cannot refund.

  • Digital-services tax is on you if you go direct to a PSP. The merchant-of-record route shifts that liability to them — for many small AI API sellers that alone justifies the higher cut.

  • Reconcile daily by comparing your ledger sum against the settlement report, not the order count. A single FX rounding difference compounded over a month is a real number.

  • Localise the payment step, not just the landing page. Buyers abandon when the page switches to English exactly where they have to confirm in Alipay.

The integration is the easy part. The hard part is deciding, before you write any code, that every buyer must prepay — and then making that wallet the only source of truth your API trusts.

If you only need to spend credits, skip Alipay entirely

Everything above is for the seller side. If you are a developer who just wants to call a DeepSeek model, you do not need to solve Alipay at all: AiCredits sells DeepSeek API credits that you can buy with an international card or PayPal, no Chinese phone number, bank account or Alipay wallet required. Point the OpenAI SDK at the endpoint in the code samples above and it works the same way from any country.

Current credit packs and rates are listed at aicreditsapi.com/pricing — the model to start with is deepseek-v4-flash, and reach for deepseek-v4-pro only when a task genuinely needs it.

Frequently asked questions

Can a US or EU company accept Alipay directly?

No. Alipay's domestic merchant products require a mainland China business licence and a Chinese bank account. Overseas companies accept Alipay through a PSP or acquirer that has Alipay cross-border or Alipay+ enabled, and settle in their own currency.

Do I need a Chinese entity to accept Alipay payments?

Not for cross-border acquiring through a PSP. You only need a mainland entity if you want domestic CNY merchant rates and local settlement, which almost never makes sense for an API product sold internationally.

Does Stripe support Alipay?

Stripe lists Alipay as a payment method for merchants in some countries, but availability depends on your registered country and business category. Check the current supported-countries list for your entity before designing your checkout around it.

How do refunds work for Alipay payments?

Refunds go back through the same PSP and the same channel, inside that provider's refund window. Store the provider transaction id on the order row — without it you cannot issue the refund later, and bonus or promotional credits should be non-refundable by policy.

Can I run subscriptions on Alipay?

Cross-border recurring agreements exist but are limited and vary by provider. For an API product, prepaid credit top-ups are simpler, avoid involuntary-churn edge cases, and map cleanly onto metered usage.

What if I just want to buy DeepSeek credits, not sell them?

Buy them from AiCredits with a card or PayPal — no Chinese phone number, bank account or Alipay setup needed. Then call deepseek-v4-flash through the OpenAI SDK with the base URL shown above.

Still stuck at DeepSeek's checkout?

This article explains why the payment fails. If what you actually need is a working key today, there is a shorter path: prepaid DeepSeek credits, no subscription, key issued to your account right after checkout.

  • $9 / $19 / $29 USD one-time credit packs — 1 USD = 500K credits (so $9 = 4.5M); billed by actual usage, never expires, tax excluded
  • Card, Apple Pay, Google Pay or Alipay via Creem — no PayPal account needed
  • Email signup only — no Chinese phone number, no Chinese bank account
  • Same DeepSeek models and the same OpenAI-compatible API — change one base_url

Get a DeepSeek key → Or try it free first

Not sure how prepaid billing works? See the full DeepSeek API credits guide → — packs, usage-based billing, supported models and payment methods.

Try Lint in 2 seconds

Wrote something? Paste it here for a free grammar check. No account needed.

More Tools →

Related Tools

💻Code Explainer

Was this article helpful?

| Share on X Reddit Copy link

服务器宕机了?别等用户告诉你

Wakeless 梦哨 帮你 30 秒监控网站 / API / SSL 证书,宕机秒级告警到邮箱、飞书、Slack。免费档 30 个监控,永久免费,无需信用卡。

免费开始监控 →
💬
反馈意见 / Feedback ×