BoomPay/partners

Alipay

Add BoomPay as a parallel Boomcoin option for merchants accepting Alipay: both platforms run independent flows on the same checkout page, resolved through a shared return handler.

WalletAlipay Global Partner APIParallel checkout option

Alipay’s merchant platform, like WeChat Pay’s, doesn’t expose an API to register external settlement rails inside Alipay’s own wallet flow. BoomPay sits alongside Alipay on the checkout page rather than inside it: Alipay’s SDK handles the Alipay path, BoomPay’s redirect handles BMC, and your platform’s return handler reconciles both. Your existing Alipay integration is unchanged.

Flow

01

Checkout prepared

Server creates an Alipay trade (unchanged) and a BoomPay intent in parallel.

02

Customer chooses

Page shows the Alipay payment button and a separate Boomcoin button.

03

BoomPay path

Customer selects Boomcoin — browser redirects to BoomPay's hosted page.

04

Customer pays

Customer approves from their Boom wallet.

05

Signed return

BoomPay redirects with paymentIntentId and X-Boom-Signature.

06

Confirm

Handler verifies signature, confirms via getPayment(), notifies merchant.

Code

alipay/prepare-checkout.js
const BoomPay = require('boom-pay-sdk');

// For merchants accepting Alipay, add a BoomPay option in parallel.
// Alipay's Global Business SDK handles the Alipay flow unchanged;
// BoomPay is an additive redirect option on the same checkout page.
async function prepareCheckout(merchant, order) {
  const boomPay = new BoomPay({
    apiKey: merchant.boompayApiKey,
    sandbox: process.env.NODE_ENV !== 'production',
  });

  // Create Alipay trade as normal -- unchanged by adding BoomPay.
  const alipayTrade = await createAlipayTrade(merchant, order);

  // Create BoomPay intent for the Boomcoin option.
  const intent = await boomPay.payments.createIntent({
    amount: toBmc(order.total, order.currency),
    successUrl: `${process.env.PSP_BASE}/boompay/return?status=success&order=${order.id}&mid=${merchant.id}`,
    failureUrl: `${process.env.PSP_BASE}/boompay/return?status=failure&order=${order.id}&mid=${merchant.id}`,
    label: `${merchant.name} Order ${order.reference}`,
    metadata: { orderId: order.id, merchantId: merchant.id },
  });

  return {
    alipayPayUrl: alipayTrade.payUrl,
    boompayLink: intent.link,
  };
}

function toBmc(amount, currency) { return amount; } // placeholder
async function createAlipayTrade(merchant, order) { /* your existing Alipay code */ }
alipay/boompay-return.js
const crypto = require('crypto');
async function handleBoompayReturn(req, res) {
  const { order: orderId, mid, status } = req.query;
  const intentId = req.query.paymentIntentId;
  const signature = (req.query['X-Boom-Signature'] || '').replace(/ /g, '+');
  const merchant = await db.getMerchant(mid);
  const expected = crypto.createHmac('sha1', merchant.boompayApiKey).update(intentId).digest('base64');
  if (!crypto.timingSafeEqual(Buffer.from(expected), Buffer.from(signature))) return res.status(403).send('Invalid signature');
  const boomPay = new BoomPay({ apiKey: merchant.boompayApiKey, sandbox: process.env.NODE_ENV !== 'production' });
  const payment = await boomPay.payments.getPayment(intentId);
  if (status === 'success' && payment.paidAt) {
    await db.markOrderPaid(orderId, { provider: 'boompay', reference: intentId });
    await notifyMerchant(merchant, 'PAYMENT_COMPLETE', orderId);
    return res.redirect(merchant.successUrl);
  }
  await db.markOrderFailed(orderId);
  res.redirect(merchant.failureUrl);
}

Go-live checklist

  • Implement toBmc() with a real conversion rate.
  • Lock the order once either Alipay or BoomPay flow activates to prevent double-fulfillment.
  • For merchants in mainland China: confirm BoomPay’s hosted page is accessible in the deployment region.