wordpress - How to implement PayPal Adaptive payments to WooCommerce -
i'm writing extenstion woocommerce plugin , got 1 problem multiple payments. want use paypal , think best way implement paypal adaptive payments. i've read paypal's , woocommerce's documentation can't figure out.
i got defined new payment gateway, documentations said: http://docs.woothemes.com/document/payment-gateway-api/
class wc_gateway_adaptive_paypal extends wc_payment_gateway { public $environment = 'sandbox'; public function __construct() { $this->notify_url = str_replace( 'https:', 'http:', add_query_arg( 'wc-api', 'wc_gateway_adaptive_paypal', home_url( '/' ) ) ); $this->id = 'adaptive_paypal'; $this->has_fields = false; $this->method_title = 'paypal'; $this->method_description = 'handle payment many receivers (up 5)'; $this->init_form_fields(); $this->init_settings(); $this->title = $this->get_option( 'title' ); add_action( 'woocommerce_update_options_payment_gateways_'.$this->id, array( $this, 'process_admin_options' ) ); } public function init_form_fields() { $this->form_fields = array( 'enabled' => array( 'title' => __( 'enable/disable', 'wpgmpc' ), 'type' => 'checkbox', 'label' => __( 'enable adaptive paypal payment', 'wpgmpc' ), 'default' => 'yes' ), 'title' => array( 'title' => __( 'title', 'wpgmpc' ), 'type' => 'text', 'description' => __( 'this controls title user sees during checkout.', 'wpgmpc' ), 'default' => __( 'paypal', 'wpgmpc' ), 'desc_tip' => true, ), 'description' => array( 'title' => __( 'customer message', 'wpgmpc' ), 'type' => 'textarea', 'default' => '' ), 'percentage' => array( 'title' => __( 'fee', 'wpgmpc' ), 'type' => 'number', 'description' => __( 'decide how want take each payment in %', 'wpgmpc' ), 'desc_tip' => true, 'default' => '0' ), 'receiver_email' => array( 'title' => __( 'receiver email', 'woocommerce' ), 'type' => 'email', 'description' => __( 'if differs email entered above, input main receiver email paypal account. used validate ipn requests.', 'woocommerce' ), 'default' => '', 'desc_tip' => true, 'placeholder' => 'you@youremail.com' ), ); } public function process_payment( $order_id ) { } }
but according default paypal payment implemented in woocommerce it's messed up.
i know that: - must call api paykey - must use curl
i don't know how redirect user paypal's payment page , how paykey within woocommerce gateway api. used snippets found on didn't work @ all.
i appreciate help. thanks!
edit: right noticed can make redirection wordpress custom url in process_payment method! still don't know how implement ipn. when receive paykey can redirect url it?
Comments
Post a Comment