Skip to content

Instantly share code, notes, and snippets.

@webaware
Last active June 15, 2020 02:05
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save webaware/6f0fd469855e7c2d5b8495b9708c8003 to your computer and use it in GitHub Desktop.
Save webaware/6f0fd469855e7c2d5b8495b9708c8003 to your computer and use it in GitHub Desktop.
specify a custom Invoice Reference for Gravity Forms eWAY (Free and Pro) transactions. https://gfeway.webaware.net.au/
<?php
/*
Plugin Name: GFeWAY Invoice Reference
Plugin URI: https://gist.github.com/webaware/6f0fd469855e7c2d5b8495b9708c8003
Description: specify Invoice Reference for Gravity Forms eWAY transaction
Version: 1
Author: WebAware
Author URI: https://gfeway.webaware.net.au/
*/
if (!defined('ABSPATH')) {
exit;
}
/**
* change the Invoice Reference field to a custom value
* @param string $invoiceReference
* @param array $form the Gravity Forms form
* @return string
*/
add_filter('gfeway_invoice_ref', function($invoiceReference, $form) {
// set your custom reference here; perhaps a WordPress User ID, or field value
$invoiceReference = uniqid();
return $invoiceReference;
}, 10, 2);
@cjwebdev
Copy link

Thanks @samheavyside,

That's great you can access the $_POST object so easily.

Really appreciate you sharing - have a great day!

CJ

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment