Developer Docs
Table of Contents
edd_moneybird_client_create_payment
Modify the payment, e.g. payment date, price or transaction ID, before it’s sent to the API.Example: modify the payment’s Transaction ID
Note that you can also use theedd_moneybird_payment_transaction_id
filter for this. This is just an example to illustrate the possibilities.function daan_modify_payment_transaction_id($payment, $invoice_id) {
$payment['payment']['transaction_identifier'] = 'your-custom-transaction-id';
return $payment;
}
add_filter('edd_moneybird_client_create_payment', 'daan_modify_payment_transaction_id', 10, 2);
Code language: PHP (php)
edd_moneybird_client_sales_invoice_contents
This filter allows for the modification of the sales invoice contents.
Example: modify the sales invoice’s reference
function daan_modify_sales_invoice_reference($invoice, $payment, $order_id, $contact_id) {
$invoice['reference'] = 'your-custom-reference';
return $invoice;
}
add_filter('edd_moneybird_client_sales_invoice_contents', 'daan_modify_sales_invoice_reference', 10, 4);
Code language: PHP (php)
Example: add a Custom Field Attribute
function daan_add_custom_fields_attributes($invoice, $payment, $order_id, $contact_id) {
$invoice['custom_fields_attributes'] = [
[
'id' => 'your-id',
'value' => 'your-value';
]
];
return $invoice;
}
add_filter('edd_moneybird_client_sales_invoice_contents', 'daan_add_custom_fields_attributes', 10, 4);
Code language: PHP (php)
edd_moneybird_contact_information
This filter allows you to modify the contact’s information, before saving it as a Moneybird contact. This filter is triggered when a contact is either updated or newly created.Example: add company name from a custom checkout field
function daan_add_company_name( $contact, $payment, $customer ) {
$contact[ 'type' ] = 'company';
$contact[ 'contact' ][ 'company_name' ] = 'Your Custom Company Name';
$contact[ 'contact' ][ 'tax_number' ] = $vat_details->vat_number ?? '';
return $contact;
}
add_filter('edd_moneybird_contact_information', 'daan_add_company_name', 10, 3);
Code language: PHP (php)