Skip to content

Instantly share code, notes, and snippets.

@gabrielmerovingi
Created November 30, 2015 23:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gabrielmerovingi/45e58fd5ee60990f6c39 to your computer and use it in GitHub Desktop.
Save gabrielmerovingi/45e58fd5ee60990f6c39 to your computer and use it in GitHub Desktop.
add_filter( 'mycred_setup_gateways', 'register_custom_gateway' );
function register_custom_gateway( $gateways ) {
// Using a gateway class
$gateways['unique-gateway-id'] = array(
'title' => __( 'Gateway Title' ),
'callback' => array( 'gateway_class_name' )
);
// or Using a gateway function
$gateways['unique-gateway-id'] = array(
'title' => __( 'Gateway Title' ),
'callback' => 'gateway_function_name'
);
return $gateways;
}
// Purchases are made locally
class My_Custom_Gateway extends myCRED_Payment_Gateway {
function __construct( $gateway_prefs ) {
parent::__construct( $args, $gateway_prefs );
}
function buy() {
$this->purchase_header( 'Header / Title' );
echo 'these things needs to be included on this page';
$this->purchase_footer();
}
}
// Purchases are done remotely
class My_Custom_Gateway extends myCRED_Payment_Gateway {
function __construct( $gateway_prefs ) {
parent::__construct( $args, $gateway_prefs );
}
function buy() {
$this->purchase_header( 'Header / Title' );
$arguments = array();
$this->form_with_redirect( $arguments );
$this->purchase_footer();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment