No $_POST data in callback from PayPal - php

I'm integrating Standard PayPal payment via NVP. I've created everything, but my problem is that on my complete page PayPal doesn't return any $_POST and $_GET data. Even, so I put rm=2 in my request to PayPal. That's totally odd. As I have checked my old PP integration as that also doesn't return any data. But I have checked it only on my localhost. Any idea? As that seems to me for PayPal issues.
Part of my call to PP NVP below:
'PWD' => $password,
'USER' => $user,
'SIGNATURE' => $signature,
'METHOD' => $method
'BUTTONTYPE' => 'BUYNOW',
'BUTTONCODE' => 'HOSTED',
'BUTTONSUBTYPE' => 'PRODUCTS',
'BUTTONCOUNTRY' => 'GB',
'BUTTONIMAGEURL' => 'https://www.paypalobjects.com/webstatic/en_US/btn/btn_buynow_107x26.png',
'L_BUTTONVAR1' => 'return=' . $this->getReturnUrl(),
'L_BUTTONVAR2' => 'notify_url=' . $this->getNotifyUrl(),
'L_BUTTONVAR3' => 'invoice=' . $this->getInvoice(),
'L_BUTTONVAR4' => 'currency_code=GBP',
'L_BUTTONVAR5' => 'item_number=1',
'L_BUTTONVAR6' => 'item_name=' . $this->getItemName(),
'L_BUTTONVAR7' => 'amount=' . $this->getAmount(),
'L_BUTTONVAR8' => 'cpp_header_image=' . $this->getHeaderImage(),
'L_BUTTONVAR9' => 'rm=2', // return data by POST method

Related

Can't get an unenrolled 3d-secure card authenticaited (secrure trading)

I am running a PHP 7.3, running on apache server. I used composer to get this library:
https://github.com/SecureTrading/PHP-API
For the code provided, I am now using the test site reference. I already managed to use for regular transitions. I now started managing 3D secure transactions, with the test MAESTRO card provided by secure trading here: https://docs.securetrading.com/document/testing/. the one designed not to demand 3D auth - that is 5000000000000421
The code provided next, will sum up the way I think thought this should work: I start by creating AUTH request, get error 30004, using CACHETOKENISE request to get a token, run THREEDQUERY to figure out if I need a full auth sceme on this card, get N as an answer, and run another AUTH request, this time with the transactionreference.
I am providing a version of the code I am testing (obviously, username, password and site reference name was removed to protect my privacy, but the code otherwise is the same)
<?php
$configData = array(
'username' => 'api#gigsberg.com',
'password' => 'xq!Kq$j4',
);
$site_refrance = 'test_gigsberg74319';
?>
<?php
$configData = array(
'username' => '*****',
'password' => '*****',
);
$site_refrance = '*****';
if (!($autoload = realpath(__DIR__ . '/vendor/autoload.php'))) {
throw new \Exception('Composer autoloader file could not be found.');
}
require_once($autoload);
$api = \Securetrading\api($configData);
$requestData = array(
'sitereference' => $site_refrance,
'requesttypedescription' => 'AUTH',
'accounttypedescription' => 'ECOM',
'currencyiso3a' => 'GBP',
'mainamount' => '1000',
'pan' => '5000000000000421',
'expirymonth' => '12',
'expiryyear' => '2030',
'securitycode' => '123',
);
echo '<pre>';
print_r($requestData);
$response = $api->process($requestData)->toArray();
print_r( $response['responses'] ); // $response['responses'][0]['errorcode'] == 30004
echo "\n--------------------------------------\n";
$transactionreference = $response['responses'][0]['transactionreference'];
$requestData = array(
'sitereference' => $site_refrance,
'expirymonth' => '12',
'expiryyear' => '2030',
'requesttypedescriptions' => array('CACHETOKENISE'),
'securitycode' => '123',
'orderreference' => $transactionreference,
'pan' => '5000000000000421'
);
print_r($requestData);
$response = $api->process($requestData)->toArray();
echo "\n--------------------------------------\n";
$cachetoken = $response['responses'][0]['cachetoken'];
$requestData = array(
'termurl' => 'https://termurl.com',
'accept' => 'text/html,*/*',
'currencyiso3a' => 'GBP',
'requesttypedescription' => 'THREEDQUERY',
'accounttypedescription' => 'ECOM',
'sitereference' => $site_refrance,
'baseamount' => '1000',
'pan' => '5000000000000421',
'expirymonth' => '12',
'expiryyear' => '2030',
'cachetoken' => $cachetoken,
);
print_r($requestData);
$response = $api->process($requestData)->toArray(); // $response['responses'][0]['enrolled'] == 'N'
/* Copying from the docs here: https://docs.securetrading.com/document/api/security/3-d-secure/
* If the enrolled value returned in the response is “Y”, the customer’s card is enrolled in 3-D secure. Please refer to the following table for enrolled values:
* .
* .
* N - The card is not enrolled in the card issuer’s 3-D Secure scheme. - Perform an AUTH Request, including the transactionreference returned in the THREEDQUERY response.
* .
* .
*/
print_r( $response['responses'] );
echo "\n--------------------------------------\n";
$transactionreference = $response['responses'][0]['transactionreference'];
$requestData = array(
'sitereference' => $site_refrance,
'requesttypedescription' => 'AUTH',
'accounttypedescription' => 'ECOM',
'currencyiso3a' => 'GBP',
'mainamount' => '1000',
'pan' => '5000000000000421',
'expirymonth' => '12',
'expiryyear' => '2030',
'securitycode' => '123',
'transactionreference' => $transactionreference
);
print_r($requestData);
$response = $api->process($requestData)->toArray();
print_r( $response['responses'] ); // Still get $response['responses'][0]['errorcode'] == 30004
I expected it to give me a note that all works well, but I still got error 30004, as if the transactionreference wasn't provided. Any idea what I can do, to fix this code, and prevent this error?
Thanks in advance
Yair
Well, I read the Api tests, and I found my error. On the last request data, instead of
$requestData = array(
.
.
'transactionreference' => $transactionreference
.
.
);
I should use
$requestData = array(
.
.
'parenttransactionreference' => $transactionreference
.
.
);
Anyway, home this helps somone

Use Paypal Pro instead of Paypal Express - Omnipay for Laravel

I have a shopping cart that currently is redirecting users to paypal directly to make their payment. I am wanting to allow customers to input their credit card on the site and paypal to process it. I have Paypal Pro account but I am having trouble using it. I am not sure how I can use the Paypal Pro package via Omnipay. In my vendors folder I have a ExpressGateway.php and a Progateway.php but not sure how to call the Progateway.php page. The only way I can see to set it is by using Omnipay::getway('paypal') which I currently do for express. What is the process i need to use in order to use Paypal Pro?
$gateway = Omnipay::gateway('paypal');
if(Auth::user() != NULL && Auth::user()->super_user == 1) {
//sandbox
$gateway->setUsername('#######');
$gateway->setPassword('#######');
$gateway->setSignature('#######');
$gateway->setTestMode('true');
} else {
//production
$gateway->setUsername('#######');
$gateway->setPassword('#######');
$gateway->setSignature('######');
}
$cardInput = array(
'firstName' => $info['first_name_bill'],
'lastName' => $info['last_name_bill'],
'billingAddress1' => $info['street_address_1_bill'],
'billingAddress2' => $info['street_address_2_bill'],
'billingPhone' => $info['phone_bill'],
'billingCity' => $info['city_bill'],
'billingState' => $info['state_bill'],
'billingPostCode' => $info['zip_bill'],
'shippingAddress1' => $info['street_address_1_ship'],
'shippingAddress2' => $info['street_address_2_ship'],
'shippingPhone' => $info['phone_ship'],
'shippingCity' => $info['city_ship'],
'shippingState' => $info['state_ship'],
'shippingPostCode' => $info['zip_ship'],
);
$card = Omnipay::creditCard($cardInput);
$response = Omnipay::purchase(
array(
'cancelUrl' => URL::to('cart'),
'returnUrl' => URL::action('CartController#getSuccessPayment', array('id' =>$invoice->id)),
'amount' => Input::get('total'),
'currency' => 'USD',
'card' => $card,
'description' => '#####'
)
)->send();`
Set the gateway this way:
$gateway = Omnipay::gateway('Paypal_Pro');

Omnipay with Paypal Express

I have an ecommerce website that redirects to a Paypal express checkout using Omnipay. It will correctly redirect the user to Paypal and return with a successful message with payerID and everything. However, it does not actually take any payment and it does not show up on our paypal account as any payment taken. I am not sure if this is a paypal issue or a configuration problem with Omnipay. I would imagine that Paypal handles this part of it but since it's not working (on our old site it works fine but we do not use Omnipay.)
$gateway = Omnipay::gateway('paypal');
//production
$gateway->setUsername('11111111');
$gateway->setPassword('1111111111');
$gateway->setSignature('111111111');
$cardInput = array(
'firstName' => $info['first_name_bill'],
'lastName' => $info['last_name_bill'],
'billingAddress1' => $info['street_address_1_bill'],
'billingAddress2' => $info['street_address_2_bill'],
'billingPhone' => $info['phone_bill'],
'billingCity' => $info['city_bill'],
'billingState' => $info['state_bill'],
'billingPostCode' => $info['zip_bill'],
'shippingAddress1' => $info['street_address_1_ship'],
'shippingAddress2' => $info['street_address_2_ship'],
'shippingPhone' => $info['phone_ship'],
'shippingCity' => $info['city_ship'],
'shippingState' => $info['state_ship'],
'shippingPostCode' => $info['zip_ship'],
);
$card = Omnipay::creditCard($cardInput);
//live
$response = Omnipay::purchase(
array(
'cancelUrl' => 'http://store.site.com/cart/cancel-payment',
'returnUrl' => 'http://store.site.com/cart/successful-payment',
'amount' => Input::get('total'),
'currency' => 'USD',
'card' => $card,
'description' => 'Stuff'
)
)->send();
if ($response->isSuccessful()) {
return Redirect('cart/successful-payment');
} elseif ($response->isRedirect()) {
$response->redirect(); // this will automatically forward the customer
} else {
return Redirect::back()->with('error', 'There was a problem. Please try again.');
}
} else {
return Redirect::to('cart/successful-payment');
}
So basically what this will do is redirect them to Paypal to make a payment then redirect back to our store. That all works fine. They can input their card number and then come back to our store after submitting it. The issue is after it gets return nothing happens through paypal. No orders or payment are exchanged.
In your return function, the function that gets called when this URL is executed: http://store.site.com/cart/successful-payment you need to call completePurchase. Something like this:
$gateway = Omnipay::gateway('paypal');
//production
$gateway->setUsername('11111111');
$gateway->setPassword('1111111111');
$gateway->setSignature('111111111');
$purchaseId = $_GET['PayerID'];
$response = $gateway->completePurchase([
'transactionReference' => $purchaseId
])->send();
// .. check $response here.

Show billing and shipping information in Paypal Express using Omnipay

I am using Laravel with Omnipay for our ecommerce application. We direct the customers to Paypal to make their purchase. We require shipping and billing information prior to placing an order and we would like that information to continue to Paypal to make it easier for them. However, only the first name and last name are crossing over to Paypal correctly. We can also use email with no issues.
public function postPayment() {
//var_dump(Session::get('shipping_info')); die;
$info = Session::get('shipping_info');
$gateway = Omnipay::gateway('paypal');
//sandbox
$gateway->setUsername('xxxx');
$gateway->setPassword('xxxx');
$gateway->setSignature('xxx');
$gateway->setTestMode('true');
//production
// $gateway->setUsername('xxxx');
// $gateway->setPassword('xxxx');
// $gateway->setSignature('xxxx');
$cardInput = array(
'firstName' => $info['first_name_bill'],
'lastName' => $info['last_name_bill'],
'billingAddress1' => $info['street_address_1_bill'],
'billingAddress2' => $info['street_address_2_bill'],
'billingPhone' => $info['phone_bill'],
'billingCity' => $info['city_bill'],
'billingState' => $info['state_bill'],
'billingPostCode' => $info['zip_bill'],
'shippingAddress1' => $info['street_address_1_ship'],
'shippingAddress2' => $info['street_address_2_ship'],
'shippingPhone' => $info['phone_ship'],
'shippingCity' => $info['city_ship'],
'shippingState' => $info['state_ship'],
'shippingPostCode' => $info['zip_ship'],
);
$card = Omnipay::creditCard($cardInput);
// var_dump($card); die;
$response = Omnipay::purchase(
array(
'cancelUrl' => 'http://localhost/public/',
'returnUrl' => 'http://localhost/public/',
'amount' => Input::get('total'),
'currency' => 'USD',
'card' => $card,
'description' => 'Stuff'
)
)->send();
$response->redirect();
}
According to the docs https://github.com/omnipay/omnipay it should work with no issues. dumping the sessions reveals the correct billing and shipping parameters.
It was just needing a cache refresh.

ADYEN Payment - SOAP Error on test SoapFault Object ( [message:protected] => security 010 Not allowed

This is my first post in this forum.
I'm trying to develop all the payments to Adyen using the WS, instead of the skin/post method that I was using until now.
So, I downloaded from their example, this code (I'm posting also the class method to connect by WS)
function Adyen($login, $password, $host ="live", $debug=FALSE ) {
$this->DEBUG = $debug;
$this->client = new SoapClient( "https://pal-$host.adyen.com/pal/Payment.wsdl",
array(
"login" => $login,
"password" => $password,
'trace' => 1,
'soap_version' => SOAP_1_1,
'style' => SOAP_DOCUMENT,
'encoding' => SOAP_LITERAL
)
);
}
function authorise( $amount,$currencyCode,$cardHolder,$cardNumber,$expm,$expy,$cvc,$reference) {
global $merchantAccount;
$response = $this->client->authorise( array(
"paymentRequest" => array
(
"amount" => array (
"value" => $amount,
"currency" => $currencyCode),
"card" => array (
"cvc" => $cvc,
"expiryMonth" => $expm,
"expiryYear" => $expy,
"holderName" => $cardHolder,
"number" => $cardNumber,
),
"merchantAccount" => $merchantAccount,
"reference" => $reference,
)
)
);
When I'm executing this code, it returns this error
#!/usr/bin/php SOAP Error on test SoapFault Object ( [message:protected] => security 010 Not allowed [string:Exception:private] =>
Do you have any suggestions to solve it?
Best Regards.
Edit:
It's too strange, cause with the same method, but with different parameters (In case of the recurring payment, I haven't this error. This the case runs
$response = $this->client->authorise(
array(
"paymentRequest" =>
array(
"amount" => array("value" => $amount,
"currency" => $currencyCode),
"merchantAccount" => $merchantAccount,
"reference" => $reference,
"shopperReference" => $reference",
"shopperEmail" => $email,
"recurring" => array("contract" => "RECURRING"),
"selectedRecurringDetailReference" => "LATEST",
"shopperInteraction" => "ContAuth"
)
)
);
Had the same question, here is the support answer:
You are trying to make an API payment. Please be aware that there are a few downsides using the direct integration API.
Most important, due to strict industry regulations, the Merchant is required to be PCI DSS (Payment Card Industry Data Security Standard) compliant at Level 1 or 2. The PCI DSS certification process requires a big contribution from you in both time and money.
http://en.wikipedia.org/wiki/PCI_DSS
The direct integration also offers a limited set of payment methods and might require you to implement features like the 3D secure mechanism.
The normal integration works as follow:
Redirect the shopper from your website to our Hosted Payment Pages.
Shopper can choose several payment methods and makes the payment.
Shopper is redirected back to your website and we pass back a result code of the payment.
We sent also a notification via SOAP or HTTP Post.
From Adyen documentation
010 Not allowed You are not allowed to perform this action
I think you should send email to their support. May be your account not ready for use.
You need to add your ip in the ca admin area for the user 'Edit Allowed User IP Range'.
I think in this code you have mistakenly put extra double quotes( "shopperReference" => $reference",).
$response = $this->client->authorise(
array(
"paymentRequest" =>
array(
"amount" => array("value" => $amount,
"currency" => $currencyCode),
"merchantAccount" => $merchantAccount,
"reference" => $reference,
"shopperReference" => $reference",
"shopperEmail" => $email,
"recurring" => array("contract" => "RECURRING"),
"selectedRecurringDetailReference" => "LATEST",
"shopperInteraction" => "ContAuth"
)
)
);

Categories