Xendit PHP SDK

repository·master·Indexed 41 days ago

https://github.com/xendit/xendit-php

Official PHP library for interacting with Xendit's REST APIs. Version 7.0.0 requires PHP 7.4 or later. The SDK provides tools for managing account balances and transactions, including classes for Balance, TransactionResponse, and DateRangeFilter, as well as enums for Currency, TransactionStatuses, and TransactionTypes.

Tokens
106K
Snippets
389
Records
459
Agent score
51%

What's inside Xendit

  1. Configure card installment settings with ChannelPropertiesCardsInstallmentConfiguration

    master

    Use the ChannelPropertiesCardsInstallmentConfiguration object to pre-set card installment options for a specific invoice. This allows you to control whether full payments are permitted and define which specific installment terms (tenors or specific banks) are available to the customer.

    use Xendit\Invoice\ChannelPropertiesCardsInstallmentConfiguration;
  2. Use ChannelProperties for invoice channel-specific settings

    master

    The ChannelProperties object is used to represent properties specific to the payment channel selected for an invoice. Currently, it supports a cards property which allows for configuration of card-related settings via the ChannelPropertiesCards class.

    use Xendit\Invoice\ChannelProperties;
  3. Handle Invoice callbacks (webhooks)

    master

    Xendit sends webhooks for invoice events (e.g., successful payments). You can use the Xendit\Invoice\InvoiceCallback object to parse and interact with the incoming callback data in your webhook handler.

    <?php
    require_once(__DIR__ . '/vendor/autoload.php');
    use Xendit\Invoice\InvoiceCallback;
    
    // Example of how you might use the callback object in a handler
    function simulateInvoiceCallback(InvoiceCallback $invoice_callback) {
        echo $invoice_callback->getId();
        // do things here with the callback
    }
  4. Configure ReceiptNotification for Payouts

    master

    The ReceiptNotification class is used to provide additional notification settings for completed payouts. It allows you to specify recipient email addresses for the payout receipt via email_to, email_cc, and email_bcc fields. Each of these fields accepts an array of strings containing valid email addresses.

    use Xendit\Payout\ReceiptNotification;
  5. Use the Bank object for invoice bank details

    master

    The Bank object represents bank details associated with an invoice. It is used to specify information such as the bank code, account holder name, and collection type when configuring bank-related invoice data.

    use Xendit\Invoice\Bank;
  6. Use NotificationPreference to configure invoice event notifications

    master

    The NotificationPreference object allows you to define which notification channels (e.g., email, SMS) are used for specific invoice lifecycle events. You can configure preferences for three distinct event types:

    • invoice_created: Channels used when a new invoice is generated.
    • invoice_reminder: Channels used when an invoice reminder is sent.
    • invoice_paid: Channels used when an invoice payment is successfully processed.

    Each property accepts an array of NotificationChannel values.

    use Xendit\Invoice\NotificationPreference;
  7. Use ChannelPropertiesCards for credit card payment properties

    master

    The ChannelPropertiesCards object is used to define properties specific to credit card payment methods within an Invoice. It allows you to restrict payments to specific Bank Identification Numbers (BINs) and configure installment plans.

    To use this class, import it via:

    use Xendit\Invoice\ChannelPropertiesCards;