ModaL
ModaL

Reputation: 219

PayPal API (the payment is successful, but the money from the card will not be charged)

I use the method of SetExpressCheckout, to successfully get the token, after, release the link, the user can make the payment:

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

Query Code:

$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\=(.*?)\&/', $paypal_create_token_content, $token); // get token

As a result, all as is necessary, there is a page account of payment:

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

And when I click on Continue, then everything goes well, but your card will not be charged if the test mode is set, but not used sandbox link. For fun, I decided to connect your PayPal account to my API data to the same payment service, where upon payment, deducted from the card means.

And yet, sometimes the bank asks for SMS code to confirm the payment, but still nothing is written down. Oddities.

What is the problem? I do not use the sandbox link, but still this trouble. I suspect that passed in the parameters that something is not right.

Upvotes: 0

Views: 500

Answers (1)

CCamilo
CCamilo

Reputation: 887

When you redirect the user to PayPal with this:

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

User will just approve the transaction but payment is not complete at this stage. You have to do the "DoExpressCheckoutPayment" call to complete the payment.

For more information please visit this link

Upvotes: 3

Related Questions