PlexySDK DOCS

Partial Payments

Allow customers to split payments across multiple payment methods in a single transaction

Partial Payments

Partial payments allow customers to pay for a single order using multiple payment methods. This is useful for combining gift cards with credit cards, splitting between cards, or using loyalty points alongside other payment methods.

How Partial Payments Work

Initialize a payment order with the total amount. This creates a container for multiple payments.

Process the first payment method for a portion (or all) of the total.

If a balance remains, collect additional payments until the order is fully paid.

Once all payments equal the order total, the order is marked as complete.

Creating a Payment Order

Start by creating a payment order that defines the total amount and allows multiple tenders.

curl -X POST https://api.plexypay.com/v2/payment-orders \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "amount": {
      "value": 100000,
      "currency": "KZT"
    },
    "reference": "order_12345",
    "merchant_id": "merchant_abc123",
    "allow_partial_payments": true,
    "expires_at": "2026-03-25T23:59:59Z",
    "metadata": {
      "customer_id": "cust_789",
      "cart_id": "cart_456"
    }
  }'

Response:

{
  "payment_order_id": "po_abc123xyz",
  "status": "pending",
  "amount": {
    "value": 100000,
    "currency": "KZT"
  },
  "paid_amount": {
    "value": 0,
    "currency": "KZT"
  },
  "remaining_amount": {
    "value": 100000,
    "currency": "KZT"
  },
  "payments": [],
  "reference": "order_12345",
  "merchant_id": "merchant_abc123",
  "expires_at": "2026-03-25T23:59:59Z"
}

Adding Payments to an Order

Add payments to the order one at a time. Each payment can use a different payment method.

First Payment: Gift Card

curl -X POST https://api.plexypay.com/v2/payment-orders/po_abc123xyz/payments \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "amount": {
      "value": 30000,
      "currency": "KZT"
    },
    "payment_method": {
      "type": "gift_card",
      "card_number": "6000000000001234",
      "pin": "1234"
    },
    "merchant_id": "merchant_abc123"
  }'

Response:

{
  "payment_id": "pay_giftcard_001",
  "payment_order_id": "po_abc123xyz",
  "status": "authorized",
  "amount": {
    "value": 30000,
    "currency": "KZT"
  },
  "payment_method": {
    "type": "gift_card",
    "last4": "1234",
    "remaining_balance": {
      "value": 20000,
      "currency": "KZT"
    }
  },
  "payment_order_status": {
    "status": "partially_paid",
    "paid_amount": {
      "value": 30000,
      "currency": "KZT"
    },
    "remaining_amount": {
      "value": 70000,
      "currency": "KZT"
    }
  }
}

Second Payment: Credit Card for Remaining Balance

curl -X POST https://api.plexypay.com/v2/payment-orders/po_abc123xyz/payments \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "amount": {
      "value": 70000,
      "currency": "KZT"
    },
    "payment_method": {
      "type": "card",
      "number": "4111111111111111",
      "expiry_month": "03",
      "expiry_year": "2028",
      "cvc": "737"
    },
    "merchant_id": "merchant_abc123"
  }'

Response:

{
  "payment_id": "pay_card_002",
  "payment_order_id": "po_abc123xyz",
  "status": "authorized",
  "amount": {
    "value": 70000,
    "currency": "KZT"
  },
  "payment_method": {
    "type": "card",
    "brand": "visa",
    "last4": "1111"
  },
  "payment_order_status": {
    "status": "paid",
    "paid_amount": {
      "value": 100000,
      "currency": "KZT"
    },
    "remaining_amount": {
      "value": 0,
      "currency": "KZT"
    }
  }
}

Retrieving Payment Order Status

Check the current state of a payment order including all associated payments.

curl https://api.plexypay.com/v2/payment-orders/po_abc123xyz \
  -H "x-api-key: YOUR_API_KEY"

Response:

{
  "payment_order_id": "po_abc123xyz",
  "status": "paid",
  "amount": {
    "value": 100000,
    "currency": "KZT"
  },
  "paid_amount": {
    "value": 100000,
    "currency": "KZT"
  },
  "remaining_amount": {
    "value": 0,
    "currency": "KZT"
  },
  "payments": [
    {
      "payment_id": "pay_giftcard_001",
      "status": "captured",
      "amount": {
        "value": 30000,
        "currency": "KZT"
      },
      "payment_method": {
        "type": "gift_card",
        "last4": "1234"
      }
    },
    {
      "payment_id": "pay_card_002",
      "status": "captured",
      "amount": {
        "value": 70000,
        "currency": "KZT"
      },
      "payment_method": {
        "type": "card",
        "brand": "visa",
        "last4": "1111"
      }
    }
  ],
  "reference": "order_12345",
  "merchant_id": "merchant_abc123",
  "completed_at": "2026-03-25T10:35:00Z"
}

Payment Order States

StateDescription
pendingNo payments have been made yet
partially_paidSome payments received, balance remaining
paidFull amount has been paid
expiredOrder expired before full payment
cancelledOrder was cancelled

Supported Payment Combinations

Plexy supports combining these payment methods in a single order:

MethodCan Be Combined With
Credit/Debit CardGift Cards, Loyalty Points, Other Cards
Gift CardCards, Other Gift Cards, Loyalty Points
Loyalty PointsCards, Gift Cards
BNPLCards, Gift Cards (for down payment)

Some payment methods have restrictions on combinations. For example, certain BNPL providers may not allow combining with other BNPL services.

Frontend Implementation

Build a UI that guides customers through the multi-tender checkout process.

import { useState, useEffect } from 'react';

function MultiTenderCheckout({ orderId, orderTotal, currency }) {
  const [paymentOrder, setPaymentOrder] = useState(null);
  const [selectedMethod, setSelectedMethod] = useState('card');

  useEffect(() => {
    // Create or fetch payment order
    async function initPaymentOrder() {
      const response = await fetch('/api/payment-orders', {
        method: 'POST',
        headers: { 'Content-Type': 'application/json' },
        body: JSON.stringify({
          orderId,
          amount: orderTotal,
          currency,
        }),
      });
      const data = await response.json();
      setPaymentOrder(data);
    }
    initPaymentOrder();
  }, [orderId, orderTotal, currency]);

  const handleAddPayment = async (paymentDetails) => {
    const response = await fetch(
      `/api/payment-orders/${paymentOrder.id}/payments`,
      {
        method: 'POST',
        headers: { 'Content-Type': 'application/json' },
        body: JSON.stringify(paymentDetails),
      },
    );

    const result = await response.json();
    setPaymentOrder((prev) => ({
      ...prev,
      paidAmount: result.paymentOrderStatus.paidAmount,
      remainingAmount: result.paymentOrderStatus.remainingAmount,
      payments: [...prev.payments, result],
    }));

    if (result.paymentOrderStatus.status === 'paid') {
      // Redirect to confirmation
      window.location.href = `/order-confirmation?id=${orderId}`;
    }
  };

  if (!paymentOrder) return <div>Loading...</div>;

  const isPaid = paymentOrder.remainingAmount.value === 0;

  return (
    <div className="multi-tender-checkout">
      <OrderSummary
        total={paymentOrder.amount}
        paid={paymentOrder.paidAmount}
        remaining={paymentOrder.remainingAmount}
        payments={paymentOrder.payments}
      />

      {!isPaid && (
        <>
          <PaymentMethodSelector
            selected={selectedMethod}
            onSelect={setSelectedMethod}
            remainingAmount={paymentOrder.remainingAmount}
          />

          <PaymentForm
            method={selectedMethod}
            maxAmount={paymentOrder.remainingAmount}
            onSubmit={handleAddPayment}
          />
        </>
      )}

      {isPaid && (
        <div className="success-message">Order fully paid! Redirecting...</div>
      )}
    </div>
  );
}

function OrderSummary({ total, paid, remaining, payments }) {
  return (
    <div className="order-summary">
      <h3>Payment Summary</h3>

      {payments.map((payment, index) => (
        <div key={payment.payment_id} className="payment-row">
          <span>
            {payment.payment_method.type === 'gift_card' && 'Gift Card'}
            {payment.payment_method.type === 'card' &&
              `${payment.payment_method.brand} ****${payment.payment_method.last4}`}
          </span>
          <span>{formatCurrency(payment.amount)}</span>
        </div>
      ))}

      <div className="divider" />

      <div className="summary-row total">
        <span>Order Total</span>
        <span>{formatCurrency(total)}</span>
      </div>

      <div className="summary-row paid">
        <span>Amount Paid</span>
        <span>{formatCurrency(paid)}</span>
      </div>

      {remaining.value > 0 && (
        <div className="summary-row remaining">
          <span>Remaining Balance</span>
          <span>{formatCurrency(remaining)}</span>
        </div>
      )}
    </div>
  );
}

Gift Card Combinations

Gift cards are the most common use case for partial payments. Check the gift card balance first, then apply the appropriate amount to the payment order.

Step 1: Check gift card balance

curl -X POST https://api.plexypay.com/v2/gift-cards/check-balance \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "card_number": "6000000000001234",
    "pin": "1234",
    "merchant_id": "merchant_abc123"
  }'

Step 2: Get the current remaining amount on the payment order

curl https://api.plexypay.com/v2/payment-orders/po_abc123xyz \
  -H "x-api-key: YOUR_API_KEY"

Use Math.min(balance.amount.value, paymentOrder.remaining_amount.value) to determine the amount to apply.

Step 3: Add the gift card payment

curl -X POST https://api.plexypay.com/v2/payment-orders/po_abc123xyz/payments \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "amount": { "value": 30000, "currency": "KZT" },
    "payment_method": {
      "type": "gift_card",
      "card_number": "6000000000001234",
      "pin": "1234"
    },
    "merchant_id": "merchant_abc123"
  }'

Cancelling and Refunding

Cancel Unpaid Payment Order

curl -X POST https://api.plexypay.com/v2/payment-orders/po_abc123xyz/cancel \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "merchant_id": "merchant_abc123",
    "reason": "Customer requested cancellation"
  }'

Refund Completed Payment Order

When refunding a multi-tender order, Plexy automatically distributes the refund across payment methods.

curl -X POST https://api.plexypay.com/v2/payment-orders/po_abc123xyz/refunds \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "amount": {
      "value": 50000,
      "currency": "KZT"
    },
    "merchant_id": "merchant_abc123",
    "reason": "Item returned"
  }'

Response:

{
  "refund_id": "ref_xyz789",
  "payment_order_id": "po_abc123xyz",
  "amount": {
    "value": 50000,
    "currency": "KZT"
  },
  "status": "processed",
  "refund_distribution": [
    {
      "payment_id": "pay_card_002",
      "amount": {
        "value": 50000,
        "currency": "KZT"
      },
      "method": "card",
      "status": "refunded"
    }
  ]
}

Gift card refunds typically return funds to the original gift card. If the gift card is no longer available, a new gift card may be issued or the refund may go to an alternative method.

Webhook Events

PAYMENT_ORDER_PAID

Sent when a payment order is fully paid.

{
  "event_type": "PAYMENT_ORDER_PAID",
  "event_id": "evt_abc123",
  "created_at": "2026-03-25T10:35:00Z",
  "data": {
    "payment_order_id": "po_abc123xyz",
    "reference": "order_12345",
    "merchant_id": "merchant_abc123",
    "amount": {
      "value": 100000,
      "currency": "KZT"
    },
    "payments_count": 2,
    "payments": [
      {
        "payment_id": "pay_giftcard_001",
        "amount": { "value": 30000, "currency": "KZT" },
        "method": "gift_card"
      },
      {
        "payment_id": "pay_card_002",
        "amount": { "value": 70000, "currency": "KZT" },
        "method": "card"
      }
    ]
  }
}

Testing

Use test payment methods to simulate partial payment scenarios:

Test CardBehavior
4111 1111 1111 1111Successful card payment
6000 0000 0000 0001Test gift card with 50,000 KZT balance
6000 0000 0000 0002Test gift card with 10,000 KZT balance

Best Practices

Always show customers what they've paid and what remains, updating in real-time as payments are added.

If one payment in a sequence fails, don't void the successful payments. Allow retry or alternative methods.

Give customers enough time to complete multi-tender checkout, but not so long that authorizations expire.

Check gift card balances and card validity before attempting to add payments.

Plan your refund strategy for multi-tender orders during the design phase.

Next Steps

On this page