Ledger Nano X - The secure hardware wallet
SHARE
TWEET

GravityForms Authorize.net Add-on Transaction Data Filter

tex2005 Feb 6th, 2013 787 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /**
  2.  * E-COMM -- Authorize.net API for GravityForms
  3.  *
  4.  * Modify the transaction data sent to Authorize.net
  5.  * Ref: plugins/gravityformsauthorizenet/authorizenet.php
  6.  */
  7.  
  8. add_filter('gform_authorizenet_before_single_payment','my_anet_custom_fields', 10, 2);
  9. function my_anet_custom_fields($transaction, $form_data) {
  10.  
  11.         # GET DATA FROM FORM INPUT
  12.         $form_data["my_invoice"] = rgpost("input_7"); // different for each form!
  13.         $form_data["customer_id"] = rgpost("input_8"); // different for each form!
  14.         $form_data["custom_data"] = rgpost("input_9"); // different for each form!
  15.  
  16.         # ADD DATA TO TRANSACTION OBJECT
  17.         $transaction->invoice_num       = $form_data["my_invoice"];
  18.         $transaction->cust_id           = $form_data["customer_id"];
  19.         $transaction->description       = 'My Custom Data: ' . $form_data["custom_data"];
  20.  
  21.         # CUSTOM FIELDS: based on the AuthNet AIM api, this should work but it does NOT.
  22.         //$transaction->setCustomField("Color", "Blue");       
  23.        
  24.         return $transaction;
  25. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top