How to Integrate Notifications in EDD Gateways
Learn how to integrate EDD Gateways notifications with external payment gateways.
Function Reference
Use the following function to integrate your payment gateway with EDD Gateways notifications:
/**
* Insert payment gateway metadata and trigger notifications.
*
* @since 1.0.1
* @param int $order_id Order ID associated with the payment.
* @param string $channel Payment gateway channel identifier.
* @param string $link URL link to the payment gateway.
* @param string|int $expires Expiration timestamp or date string.
* @return void
*/
function edd_gateways_insert( $order_id, $channel, $link, $expires ) {
$order_id = intval( $order_id );
$channel = esc_html( $channel );
$link = esc_url( $link );
$expires = ! is_numeric( $expires ) ? strtotime( $expires ) : intval( $expires );
edd_update_order_meta( $order_id, EDD_PELATFORM_GATEWAYS . '_channel', $channel );
edd_add_order_meta( $order_id, EDD_PELATFORM_GATEWAYS . '_link', $link );
edd_add_order_meta( $order_id, EDD_PELATFORM_GATEWAYS . '_expires', $expires );
do_action( 'edd_gateway_send_notifications', $order_id );
}
Integration
Xendit
Integrate Xendit with EDD Gateways notifications by following these steps:
Go to your WordPress admin dashboard and open the Plugin Editor → Xendit.
Open the file located at:
edd-xendit/includes/methods/EDDXenditInvoice.php
Insert the following script at approximately line 149, after the invoice creation:
edd_gateways_insert( $order_id, $method, $response['invoice_url'] . '#' . $method, $response['expiry_date'] );
Click Update File to save your changes.
Now, payments made through Xendit will trigger EDD Gateway notifications, providing seamless communication with your customers.
Last updated on