PHP code example of wp-pay-gateways / mollie

1. Go to this page and download the library: Download wp-pay-gateways/mollie library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

wp-pay-gateways / mollie example snippets


\add_filter( 'pronamic_pay_mollie_payment_description', 'your_function_name', 10, 2 );

\add_filter( 'pronamic_pay_mollie_payment_description', function( $description, $payment ) {
	$periods = $payment->get_periods();

	if ( null === $periods ) {
		return $description;
	}

	foreach ( $periods as $period ) {
		$phase = $period->get_phase();

		$subscription = $phase->get_subscription();

		$description = \sprintf(
			'%s - %s - %s',
			$subscription->get_description(),
			$period->get_start_date()->format_i18n( 'd-m-Y' ),
			$period->get_end_date()->format_i18n( 'd-m-Y' )
		);
	}

	return $description;
}, 10, 2 );

\add_filter( 'pronamic_pay_mollie_payment_metadata', 'your_function_name', 10, 2 );

\add_filter( 'pronamic_pay_mollie_payment_metadata', function( $metadata, $payment ) {
	$data = array();

	$customer = $payment->get_customer();

	if ( null !== $customer ) {
		$vat_number = $customer->get_vat_number();

		if ( null !== $vat_number ) {
			$data['vat_number'] = $vat_number->normalized();
		}
	}

	switch ( $payment->get_source() ) {
		case 'easydigitaldownloads':
			$data['edd_order_id'] = $payment->get_source_id();

			break;
		case 'gravityformsideal':
			$data['gf_entry_id'] = $payment->get_source_id();

			break;
	}

	return (object) $data;
}, 10, 2 );

\add_filter( 'pronamic_pay_mollie_payment_billing_email', 'your_function_name', 10, 2 );

\add_filter( 'pronamic_pay_mollie_payment_billing_email', function( $billing_email, $payment ) {
	$billing_email = '[email protected]';

	return $billing_email;
}, 10, 2 );