Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Filters for Caldera Forms Authorize.net subscriptions (eCheck and Credit Card) -- REQUIRES version 2.1.0 or later -- https://calderaforms.com/downloads/authorize-net-for-caldera-forms/
<?php
/**
* Change billing interval for Caldera Forms Authorize.net subscriptions
*
* @param \net\authorize\api\contract\v1\PaymentScheduleType\IntervalAType $type
* @param Caldera_Forms_Processor_Get_Data $data_object
* @param array $form
*/
add_filter( 'cf_auth_net_arb_interval', function( $interval, $data_object, $form ){
$interval->setUnit( 'daily' );
return $interval;
}, 10, 3 );
<?php
/**
* Make Caldera Forms Authorize.net subscription start one week later
*
* @param \net\authorize\api\contract\v1\PaymentScheduleType $subscription
* @param Caldera_Forms_Processor_Get_Data $data_object
* @param array $form
*/
add_filter( 'cf_auth_net_arb_payment_schedule', function( $paymentSchedule, $data_object, $form ){
//Update for your form ID
if ( 'cf12332' === $form[ 'ID' ] ) {
//You must pass a valid DateTime object!
//See- http://php.net/manual/en/datetime.construct.php
$paymentSchedule->setStartDate( new DateTime( date( "Y-m-d", strtotime( "+1 week" ) ) ) );
}
return $paymentSchedule;
}, 10, 3 );
<?php
/**
* Change the reference ID for a Caldera Forms subscription plan created with Authorize.net
*/
add_filter( 'cf_auth_net_ref_id', function( $refId, $form ){
//make sure to change field value
$field_id = 'fld_134';
$value = Caldera_Forms::get_field_data( $field_id, $form );
if( ! empty( $value ) ){
$refId = $value;
}
return $refId;
}, 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.