Skip to content

Transfers (P2P)

Send money instantly between Payd accounts. Transfers are immediate — the funds arrive in the recipient's Payd wallet right away, no webhook needed (though one is sent if configured).

Basic Usage

typescript
const result = await payd.transfers.send({
  receiverUsername: "recipient_user",
  amount: 100,
  narration: "Lunch money",
  phoneNumber: "+254700000000",
});

console.log(result.transactionReference); // "9BD12041887.eS"
console.log(result.success);             // true

Parameters

ParameterTypeRequiredDescription
receiverUsernamestringYesPayd username of the recipient
amountnumberYesAmount to transfer (must be > 0)
narrationstringYesDescription of the transfer
phoneNumberstringNoRecipient's phone with country code (e.g., +254700000000)
currencystringNoCurrency code (Payd auto-converts if different)
walletType"local" | "USD"NoWhich wallet to fund from (default: "local")

Response

typescript
interface TransferResponse {
  success: boolean;
  message: string;
  status: string;
  transactionReference: string;
  trackingId: string;
  reference: string;
  result: unknown;
  _raw: Record<string, unknown>;
}

Key Differences from Payouts

FeatureTransfersPayouts
SpeedInstantAsync (webhook confirmation)
DestinationPayd accountM-Pesa / bank / mobile money
WebhookOptionalRequired
IdentifierreceiverUsernamephoneNumber + accountNumber

Complete Example

typescript
async function sendToUser(receiver: string, amount: number) {
  try {
    const result = await payd.transfers.send({
      receiverUsername: receiver,
      amount,
      narration: `Transfer to ${receiver}`,
      phoneNumber: "+254700000000",
    });

    if (result.success) {
      console.log(`Sent ${amount} to ${receiver}`);
      console.log(`Ref: ${result.transactionReference}`);
    }

    return result;
  } catch (error) {
    if (error instanceof PaydValidationError) {
      console.error(`Invalid input: ${error.message}`);
    }
    throw error;
  }
}

Released under the MIT License.