PayPal API (payments are made, but nothing is written off from the map)



  • Used method https://developer.paypal.com/webapps/developer/docs/classic/api/merchant/SetExpressCheckout_API_Operation_NVP/ , Receiving successful token, after, handing it over to the reference so that the user can pay:

    https://www.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=<? echo $token[1]; ?>
    

    Cricket of creation token'a:

    $paypal_create_token = post('https://api-3t.paypal.com/nvp', 
     array(
      'params' => array(
       'USER' => $paypal_config['user'],
       'PWD' => $paypal_config['password'],
       'SIGNATURE' => $paypal_config['sign'],
       'METHOD' => 'SetExpressCheckout',
       'VERSION' => $paypal_config['version'],
       'REQCONFIRMSHIPPING' => 0,
       'NOSHIPPING' => 1,
       'SOLUTIONTYPE' => 'Sole',
       'LANDINGPAGE' => 'Billing',
       'LOGOIMG' => $protocol.'://'.$host.'/images/logo197x40.png?'.$time,
       'HDRIMG' => $protocol.'://'.$host.'/images/logo.png?'.$time,
       'BRANDNAME' => mb_strtoupper($host),
       'PAYMENTREQUEST_0_AMT' => $amount,
       'PAYMENTREQUEST_0_ITEMAMT' => $amount,
       'L_PAYMENTREQUEST_0_AMT0' => $amount,
       'L_PAYMENTREQUEST_0_NAME0' => $description,
       'PAYMENTREQUEST_0_INVNUM' => $order_id,
       'L_PAYMENTREQUEST_0_NUMBER0' => $order_id,
       'PAYMENTREQUEST_0_PAYMENTACTION' => 'SALE',
       'PAYMENTREQUEST_0_CURRENCYCODE' => 'RUB',
       'EMAIL' => $orders_info['email'],
       'RETURNURL' => $paypal_config['success_url'].'?order_id='.$order_id.'&order_hash='.$order_hash,
       'CANCELURL' => $paypal_config['fail_url'].'?order_id='.$order_id.'&order_hash='.$order_hash,
      )
     )
    );
    

    $paypal_create_token_content = $paypal_create_token['content'];

    preg_match('/TOKEN=(.*?)&amp;/', $paypal_create_token_content, $token); // получаем token

    In the end, it's all right, there's a payroll page:

    введите сюда описание изображения

    And when I press Continue.Everything is going well, but the map does not sign off as if a test regime is in place, although sandbox is not used. For the sake of interest, I decided to connect my PayPal account to my API data on one payroll, there after payment, the money was written off.

    And also, sometimes the bank asks for text code to confirm the paycheck, but it doesn't fit. Strange.

    What's the problem? I don't use sandbox, but there's a problem. I suspect I've given you something wrong.



  • It's been very simple, I didn't confirm the transaction after redirecting to the successful pay page that GET was asked to transmit the parameters. token and PayerID

    The proof of the transaction shall be such as:

    post('https://api-3t.paypal.com/nvp', 
     array(
      'params' => array(
       'USER' => $paypal_config['user'],
       'PWD' => $paypal_config['password'],
       'SIGNATURE' => $paypal_config['sign'],
       'METHOD' => 'DoExpressCheckoutPayment',
       'VERSION' => $paypal_config['version'],
       'PAYMENTREQUEST_0_AMT' => $amount,
       'PAYMENTREQUEST_0_ITEMAMT' => $amount,
       'L_PAYMENTREQUEST_0_AMT0' => $amount,
       'PAYMENTREQUEST_0_INVNUM' => $order_id,
       'L_PAYMENTREQUEST_0_NUMBER0' => $order_id,
       'PAYMENTREQUEST_0_PAYMENTACTION' => 'SALE',
       'PAYMENTREQUEST_0_CURRENCYCODE' => 'RUB',
       'token' => ((isset($_GET['token'])) ? $_GET['token'] : ''),
       'payerid' => ((isset($_GET['PayerID'])) ? $_GET['PayerID'] : '')
      )
     )
    );
    

    Thank you so much for the English stackoverflow-- https://stackoverflow.com/a/37434689/5184005


Log in to reply
 


Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2