recurring payment to already running paypal script

前端 未结 7 1318
春和景丽
春和景丽 2021-02-04 16:03

I have seen many related questions but didn\'t find any answer.

I have successfully implemented transactions through paypal but now I am asked to implement recurring pay

7条回答
  •  既然无缘
    2021-02-04 16:29

    Try The following Codes :

    $paypalObj = new paypal_class();
    
    $itemName = My Product";
    $itemNumber = $itemName . " - Premium ($amount$)";
    
    $paypalObj->paypal_url = 'https://www.sandbox.paypal.com/cgi-bin/webscr';// testing paypal url
    //$paypalObj->paypal_url = 'https://www.paypal.com/cgi-bin/webscr';// Live paypal url
    
    $paypalObj->add_field('cmd','_xclick-subscriptions');
    $paypalObj->add_field('txn_type', "recurring_payment");
    $paypalObj->add_field('product_name', "My Product Subscription - Monthly( $$amount )");
    $paypalObj->add_field('desc', "Magic Niche Finder Subscription - Monthly( $$amount )");
    
    $paypalObj->add_field('business', "test@yahoo.com");
    
    $paypalObj->add_field('return', "http://".$serverName . "/buy-now.php");
    $paypalObj->add_field('cancel_return', "http://".$serverName. "/return.php?action=cancel");
    $paypalObj->add_field('notify_url', "http://" . $serverName . "/return.php?action=ipn");
    
    $paypalObj->add_field('src', "1");
    $paypalObj->add_field('sra', "1");
    $paypalObj->add_field('a3', "$amount");
    $paypalObj->add_field('t3', "M");
    $paypalObj->add_field('p3', "1");
    //$paypalObj->add_field('no_note', "1");
    $paypalObj->add_field('currency_code', "USD");
    
    $paypalObj->add_field('first_name', $firstName);
    $paypalObj->add_field('last_name', $lastName);
    
    $paypalObj->submit_paypal_post();
    

提交回复
热议问题