Advertisement
tex2005

GravityForms Authorize.net Add-on Transaction Data Filter

Feb 6th, 2013
1,244
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.96 KB | None | 0 0
  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. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement