PayPal NVP Timeout - php

Ok, I've bashed my head against the wall for two hours on making what I assumed was a simple call to PayPal over NVP. I've tried everything, but it keeps telling me that it didn't work out because of an internal error that doesn't tell me what I did wrong.
O' great and wise Internet Jedi's, please guide this wayward Padawan? Thanks in advance :)
(
[TIMESTAMP] => 2013-07-07T09:37:28Z
[CORRELATIONID] => f2e28b7dcf9fb
[ACK] => Failure
[VERSION] => 53.0
[BUILD] => 6680107
[L_ERRORCODE0] => 10001
[L_SHORTMESSAGE0] => Internal Error
[L_LONGMESSAGE0] => Internal Error
[L_SEVERITYCODE0] => Error
[AMT] => 232.15
[CURRENCYCODE] => USD
)
Here are the contents of the NVP call:
METHOD=DoDirectPayment
VERSION=53.0
PWD=1371372778
USER=xxx
SIGNATURE=xxx
PAYMENTACTION=Sale
IPADDRESS=xxx
AMT=232.15
CREDITCARDTYPE=VISA
ACCT=4111111111111111
EXPDATE=072016
FIRSTNAME=Harvey+Brooks
LASTNAME=-
STREET=3443+Padaro+Lane
CITY=Malibu
STATE=CA
COUNTRYCODE=US
CURRENCYCODE=USD
SHIPPINGAMT=0.00
CVV2=123
EMAIL=xxxx
PHONENUM=7022403735
SHIPTONAME=Some Dude
SHIPTOSTREET=90210+S+Bend
SHIPTOSTREET2=STE+120
SHIPTOCITY=Las+Vegas
SHIPTOSTATE=NV
SHIPTOCOUNTRYCODE=US
SHIPTOPHONENUM=xxx
L_NAME0=100+ANOS%C2%AE+
L_NUMBER0=19
L_QTY0=1
L_TAXAMT0=0
L_AMT0=29.69
L_NAME1=Chivas+Regal
L_NUMBER1=69
L_QTY1=2
L_TAXAMT1=0
L_AMT1=51.29
L_NAME2=Wild+Turkey
L_NUMBER2=34
L_QTY2=1
L_TAXAMT2=0
L_AMT2=29.69
L_NAME3=Patr%C3%B3n+Silver+
L_NUMBER3=23
L_QTY3=1
L_TAXAMT3=0
L_AMT3=70.19
ITEMAMT=232.15
TAXAMT=0

VISA
4066901366000455
cvv = 123
exp date = some future date
$version = urlencode('51.0');
Try these setting
$nvpStr ="&PAYMENTACTION=$paymentType&AMT=$amount&CREDITCARDTYPE=$creditCardType&ACCT=$creditCardNumber".
"&EXPDATE=$padDateMonth$expDateYear&CVV2=$cvv2Number&FIRSTNAME=$firstName&LASTNAME=$lastName".
"&STREET=$address1&CITY=$city&STATE=$state&ZIP=$zip&COUNTRYCODE=$country&CURRENCYCODE=$currencyID";

Related

CyberSource Secure Acceptance integration with REST Api in php

I'm trying to integrate Cyber Source Payment gateway in php using REST API. And I found following reference link in github
After required changes finally I can able to login (Authenticate) to Cyber source but, Im getting below error. (I can check the logs from Cyber Source)
req_reference_number: 474 => ERROR 101 - Request parameters are invalid or missing
signed: true
Array
(
[auth_trans_ref_no] => 474
[decision] => ERROR
[message] => Request parameters are invalid or missing
[reason_code] => 101
[req_access_key] => 5e00e27842d73381b0**************
[req_amount] => 569
[req_bill_to_address_city] => Mountain View
[req_bill_to_address_country] => US
[req_bill_to_address_line1] => 1 My Apartment
[req_bill_to_address_line2] => 2 nd street
[req_bill_to_address_postal_code] => 94043
[req_bill_to_address_state] => CA
[req_bill_to_email] => someemail#somedomain.com
[req_bill_to_forename] => Elavarasan
[req_bill_to_phone] => 6508764564
[req_bill_to_surname] => Natarajan
[req_currency] => USD
[req_customer_ip_address] => 127.0.0.1
[req_device_fingerprint_id] => v1rh0p44gpnhag1a7mfp9tst25
[req_item_0_code] => KFLTFDIV
[req_item_0_name] => KFLTFDIV
[req_item_0_quantity] => 1
[req_item_0_sku] => sku001
[req_item_0_unit_price] => 20.00
[req_item_1_code] => KFLTFD70
[req_item_1_name] => KFLTFD70
[req_item_1_quantity] => 1
[req_item_1_sku] => sku002
[req_item_1_unit_price] => 10.00
[req_line_item_count] => 2
[req_locale] => en-us
[req_merchant_defined_data1] => MDD1
[req_merchant_defined_data2] => MDD2
[req_merchant_defined_data3] => MDD3
[req_merchant_defined_data4] => MDD4
[req_merchant_descriptor] => Krungsri
[req_override_custom_cancel_page] => http://localhost/cyphp/sa-wm/response.php
[req_override_custom_receipt_page] => http://localhost/cyphp/sa-wm/response.php
[req_profile_id] => *******************************
[req_reference_number] => 474
[req_transaction_type] => sale
[req_transaction_uuid] => 5aa6329409169
[required_fields] => payment_method
[signature] => IJ0iEsOJLZe2W4dNrogdzp8op8Evon2wU1KvA3W6SzM=
[signed_date_time] => 2018-03-12T07:57:00Z
[signed_field_names] => decision,req_access_key,req_profile_id,req_transaction_uuid,req_transaction_type,req_reference_number,req_amount,req_currency,req_line_item_count,req_locale,req_override_custom_receipt_page,req_override_custom_cancel_page,auth_trans_ref_no,req_item_0_code,req_item_0_name,req_item_0_quantity,req_item_0_sku,req_item_0_unit_price,req_item_1_code,req_item_1_name,req_item_1_quantity,req_item_1_sku,req_item_1_unit_price,req_bill_to_forename,req_bill_to_surname,req_bill_to_email,req_bill_to_phone,req_bill_to_address_line1,req_bill_to_address_line2,req_bill_to_address_city,req_bill_to_address_state,req_bill_to_address_country,req_bill_to_address_postal_code,req_customer_ip_address,req_device_fingerprint_id,req_merchant_defined_data1,req_merchant_defined_data2,req_merchant_defined_data3,req_merchant_defined_data4,req_merchant_descriptor,required_fields,reason_code,message,signed_field_names,signed_date_time
[utf8] => ✓
)
If I rename or remove any parameter, then authentication is failed. So I hope that, I'm passing some wrong value. But I couldn't find out which one is..
I tried to change almost every field values which I'm passing, but every time getting same error
ERROR 101 - Request parameters are invalid or missing
Finally I found sample code (php) from Cyber Source, we just have to configure as per the credential. Here is the link
Source Code
You have to define you Secret key in security.php file
define ('SECRET_KEY', '7f15d699ff14461b9a84*****');
And,
access_key and profile_id in signeddatafields.php file
<input type="hidden" name="access_key" value="5e00e27842d73******">
<input type="hidden" name="profile_id" value="43C533AC-****-****-****-*********">
That's it.
I only did the SOAP as well, but after a look at their rest v1 example, it looks like the api key and secret key are passed to create a paytoken in the Apiclient. An authorization payment should be something like this(after u install the sdk):
<?php
use \CyberSource\Authorizations as Authorizations;
use \CyberSource\Configuration as Configuration;
class CyberSource {
private $config;
function __construct($apiKey, $secretKey) {
// pass apikey and secretkey to configuration
$this->config = new Configuration($apiKey, $secretKey);
}
private function runAuth($this->config) {
$api = new Authorizations($this->config);
$jsonPayload = // ur json request payload
try{
// pass the request json payload object
$response = $api->createAuthorization($jsonPayload);
} catch (\E $e) {
//throw error here
}
}
}
if you have to use v2 then u need to read this pdf there are several things you need to add to the header for account authentication.

Get Whatsapp Password from Whatsapp api

How to get the whatsapp password using the whatsapp api?
I am still learning on using the api and have no idea to use it. I'am using sublime code editor for the code. Below is the sample code that I receive from one of the tutorials.
require_once('Chat-API/src/Registration.php');
username = "6012xxxxxxx";
$debug = true;
// Create a instance of Registration class.
$r = new Registration($username, $debug);
$r->codeRequest('sms'); // could be 'voice' too`
When I execute it, I receive this error:
Array ( [cc] => 60 [in] => 6012xxxxxxx [lg] => en [lc] => MY [id] => 蜀��|#b�պ�`���x [token] => IAW+aljx1hbtx0Vh/sqxJmKytyc= [mistyped] => 6 [network_radio_type] => 1 [simnum] => 1 [s] => [copiedrc] => 1 [hasinrc] => 1 [rcmatch] => 1 [pid] => 5138 [rchash] => 6557f1fa8776a69cc3427a6196467690cb85cc651b36cc7be02062470a72a742 [anhash] => 3c24581d24189c24a487cae2ef84d1c3 [extexist] => 1 [extstate] => 1 [mcc] => 502 [mnc] => 000 [sim_mcc] => 502 [sim_mnc] => 000 [method] => sms ) stdClass Object ( [login] => 6012xxxxxxx [status] => fail [reason] => old_version )
Fatal error: Uncaught exception 'Exception' with message 'There was a problem trying to request the code.' in C:\xampp\htdocs\tutorial\whatsapp-api\Chat-API\src\Registration.php:316 Stack trace: #0 C:\xampp\htdocs\tutorial\whatsapp-api\requestCode.php(33): Registration->codeRequest('sms') #1 {main} thrown in C:\xampp\htdocs\tutorial\whatsapp-api\Chat-API\src\Registration.php on line 316
I tried to use Wart application as well but still unable to get the password with the error of bad_token
Is there any other functions or application that I need to add. Is there also a good tutorial or video for this?
I also tried this lib, but got "fail [reason] => old_version". This library is unsupported since 10 Aug 2016. So I think it won't be working.
Try this one :
in src/Constants.php on line 22, change into
const WHATSAPP_VER = '2.17.242';
in src/Constants.php on line 27, change into
const WHATSAPP_USER_AGENT = 'WhatsApp/2.17.242 Android/4.3 Device/Xiaomi-HM_1SW';
in src/token.php on line 10, change into
$classesMd5 = 'ziYneeSZm5qExsEFX/AoMQ=='; // 2.17.242
Hope this helps.
https://github.com/tgalal/yowsup/issues/1905
I have changed the value of the constant variables in the file
src/Constants.php :
const WHATSAPP_VER = '2.18.371';
const WHATSAPP_USER_AGENT = 'WhatsApp/2.18.371 Android/4.3 Device/Xiaomi-HM_1SW';
and in the file src/token.php
$classesMd5 = 'sdGH+cA0CQfRGvQVnhZWDw==';
After that, I don't get an old_version message.
Try this one:
Open: https://coderus.openrepos.net/whitesoft/whatsapp_scratch.
Note property a and d from those json. When I write this answer, the values are>> a: 5eItLCbGXx3CKpybxo81/A== and d: 2.19.15
_MD5_CLASSES = "5eItLCbGXx3CKpybxo81/A=="
_VERSION = "2.19.15"

Omnipay paypal integration - confirming payment status

I use Omnipay paypal library. I can make a successful payment but I have problems confirming the payment status. In the response I always get PAYMENTINFO_0_PAYMENTSTATUS => Pending
Here is my purchase code - I get redirected to paypal and it's all good here:
$gateway = Omnipay::create("PayPal_Express");
$gateway->setUsername( $this->USERNAME );
$gateway->setPassword( $this->PASSWORD );
$gateway->setSignature( $this->SIGNATURE );
$gateway->setTestMode(true);
$params = [
'cancelUrl'=>'http://xxxx.com/paypal_tests/cancel',
'returnUrl'=>'http://xxxx.com/paypal_tests/confirm_paypal',
'amount' => '10.00',
'currency' => 'EUR'
];
$response = $gateway->purchase( $params )->send();
$response->redirect();
And returnUrl, where in the response I always get [PAYMENTINFO_0_PAYMENTSTATUS] => Pending:
$gateway = Omnipay::create("PayPal_Express");
$gateway->setUsername( $this->USERNAME );
$gateway->setPassword( $this->PASSWORD );
$gateway->setSignature( $this->SIGNATURE );
$gateway->setTestMode(true);
$response = $gateway->completePurchase( $this->session->PAYPAL )->send();
$data = $response->getData(); // this is the raw response object
echo print_r($data);
Here is full response, as you can see status is "Pending".
Array
(
[TOKEN] => EC-1RA27631NJ550530P
[SUCCESSPAGEREDIRECTREQUESTED] => false
[TIMESTAMP] => 2016-03-07T10:29:43Z
[CORRELATIONID] => 8010f2af74b8
[ACK] => Success
[VERSION] => 119.0
[BUILD] => 18316154
[INSURANCEOPTIONSELECTED] => false
[SHIPPINGOPTIONISDEFAULT] => false
[PAYMENTINFO_0_TRANSACTIONID] => 97R504742X7344311
[PAYMENTINFO_0_TRANSACTIONTYPE] => expresscheckout
[PAYMENTINFO_0_PAYMENTTYPE] => instant
[PAYMENTINFO_0_ORDERTIME] => 2016-03-07T10:29:41Z
[PAYMENTINFO_0_AMT] => 1.44
[PAYMENTINFO_0_TAXAMT] => 0.00
[PAYMENTINFO_0_CURRENCYCODE] => EUR
[PAYMENTINFO_0_PAYMENTSTATUS] => Pending
[PAYMENTINFO_0_PENDINGREASON] => multicurrency
[PAYMENTINFO_0_REASONCODE] => None
[PAYMENTINFO_0_PROTECTIONELIGIBILITY] => Ineligible
[PAYMENTINFO_0_PROTECTIONELIGIBILITYTYPE] => None
[PAYMENTINFO_0_SECUREMERCHANTACCOUNTID] => Z6GHSVEW4KGWG
[PAYMENTINFO_0_ERRORCODE] => 0
[PAYMENTINFO_0_ACK] => Success
)
How to confirm that payment has been processed, confirmed and it is safe to dispatch?
Thanks!
OK, I found the problem, it is here:
[PAYMENTINFO_0_PENDINGREASON] => multicurrency
Basically my customer's test account was in US and seller's test account was charging in EUR, that's why it was pending....
And the answer is here: How do I use omnipay to check if it's a pending payment or not

Paypal Mobile Library IPN verification

I'm a PHP developer. I've implemented Paypal Mobile Library IPN.
Here is what i receive in test mode.
$_POST = array(
'payment_request_date' => 'Wed Jun 15 07:21:26 PDT 2011',
'return_url' => 'https://www.paypal.com',
'fees_payer' => 'EACHRECEIVER',
'ipn_notification_url' => 'http://mysite.com/myscript.php',
'verify_sign' => 'AsPVXqWsrQkFWs.gl9jI5iQU2b53AiFm-2O-GeHSy9tAKrrPm327E81P',
'test_ipn' => 1,
'transaction' => array('USD 9.99'),
'cancel_url' => 'https://www.paypal.com',
'pay_key' => 'AP-725112792Y356822X',
'action_type' => 'CREATE',
'memo' => '55547098#1 month platinum membership',
'transaction_type' => 'Adaptive Payment PAY',
'status' => 'COMPLETED',
'log_default_shipping_address_in_transaction' => false,
'charset' => 'windows-1252',
'sender_useCredentials' => true,
'notify_version' => 'UNVERSIONED',
'reverse_all_parallel_payments_on_error' => false,
);
As I see there is a field verify_sign, so I guess that it should be verified by sending to
https://www.sandbox.paypal.com/cgi-bin/webscr
following POST request:
$req = 'cmd=_notify-validate&'.http_build_query($_POST);
But it always returns INVALID.
I also tried using SOAP request to GetTransactionDetails for validation of this transaction, asTransactionID I specified $_POST['pay_key'] (AP-725112792Y356822X) and this service returns error
10004 The transaction id is not valid
So how can I verify the Paypal Mobile Library response?
Can i check it's verification in sandbox mode or only on live.
Thank you for any suggestions.
I would recommend trying to use the IPN code sample in PHP on PayPal developer network here: https://www.x.com/developers/PayPal/documentation-tools/code-sample/216623

paypal API doExpressCheckoutPayment status Pending

I am testing recurring payments. After doExpressCheckoutPayment action i recieved status Pending in my sandbox paypal account. Why status not completed? How much time need to set status Complete? Or maybe need set some params in sandbox. I am used default settings. Payment review - disabled.
Thanks!)
UPD 1:
Here is my request code:
public function setPayment($plan){
$params = array(
'PAYMENTREQUEST_0_AMT' => '10.00',
'RETURNURL' => $this->base_url.'/paypal/response',
'CANCELURL' => $this->base_url.'/paypal/paypal',
'PAYMENTREQUEST_0_PAYMENTACTION' => 'Authorization',
'PAYMENTREQUEST_0_CURRENCYCODE' => 'GBP',
'PAYMENTREQUEST_0_DESC' => 'Testing PayPal recurring',
'PAYMENTREQUEST_0_NOTIFYURL' => 'http://barton.netai.net/ipn.php',
'L_BILLINGTYPE0' => 'RecurringPayments',
'L_BILLINGAGREEMENTDESCRIPTION0' => 'SamePayments'
);
$this->_paypal->addFields($params);
$response = $this->_paypal->request('SetExpressCheckout');
if (strtoupper($response['ACK'])=='SUCCESS'){
$token=$response['TOKEN'];
header('Location: '.$this->_paypal->getPaypalUrl().'?cmd=_express-checkout&token='.$token);
return true;
} else {
return false;
}
}
public function responseAction(){
if (isset($_GET['token']) && isset($_GET['PayerID'])){
$this->_paypal->addFields(array('TOKEN'=>$_GET['token']));
$response=$this->_paypal->request('GetExpressCheckoutDetails');
if ($response['ACK']=='Success'){
$response=array();
$this->_paypal->addFields(array(
'TOKEN' => $_GET['token'],
'PAYMENTREQUEST_0_PAYMENTACTION' => 'Authorization',
'PAYERID' => $_GET['PayerID'],
'L_BILLINGTYPE0' => 'RecurringPayments',
'L_BILLINGAGREEMENTDESCRIPTION0' => 'SamePayments',
'PAYMENTREQUEST_0_AMT' => '10.00',
'PAYMENTREQUEST_0_CURRENCYCODE' => 'GBP'
));
$response=$this->_paypal->request('DoExpressCheckoutPayment');
show($response); exit;
}
}
}
SetExpressCheckout response:
Array
(
[TOKEN] => EC-01C99915Y11155245
[TIMESTAMP] => 2012-02-24T10:23:32Z
[CORRELATIONID] => 69e91a5abc347
[ACK] => Success
[VERSION] => 84
[BUILD] => 2571254
)
doExpressCheckoutPayment response:
Array
(
[TOKEN] => EC-2FR88291S31672645
[SUCCESSPAGEREDIRECTREQUESTED] => false
[TIMESTAMP] => 2012-02-24T10:26:08Z
[CORRELATIONID] => a95c7a9bb64b3
[ACK] => Success
[VERSION] => 84
[BUILD] => 2571254
[INSURANCEOPTIONSELECTED] => false
[SHIPPINGOPTIONISDEFAULT] => false
[PAYMENTINFO_0_TRANSACTIONID] => 2RN165632T770592L
[PAYMENTINFO_0_TRANSACTIONTYPE] => expresscheckout
[PAYMENTINFO_0_PAYMENTTYPE] => instant
[PAYMENTINFO_0_ORDERTIME] => 2012-02-24T10:26:06Z
[PAYMENTINFO_0_AMT] => 10.00
[PAYMENTINFO_0_TAXAMT] => 0.00
[PAYMENTINFO_0_CURRENCYCODE] => GBP
[PAYMENTINFO_0_PAYMENTSTATUS] => Pending
[PAYMENTINFO_0_PENDINGREASON] => authorization
[PAYMENTINFO_0_REASONCODE] => None
[PAYMENTINFO_0_PROTECTIONELIGIBILITY] => Eligible
[PAYMENTINFO_0_PROTECTIONELIGIBILITYTYPE] => ItemNotReceivedEligible,UnauthorizedPaymentEligible
[PAYMENTINFO_0_SECUREMERCHANTACCOUNTID] => WLC8CZSP2C5L8
[PAYMENTINFO_0_ERRORCODE] => 0
[PAYMENTINFO_0_ACK] => Success
)
In my previous question you advised me to install PAYMENTREQUEST_0_PAYMENTACTION to Sale,
Maybe this help me to decide this problem?
As mentioned in the other question, replace;
'PAYMENTREQUEST_0_PAYMENTACTION' => 'Authorization',
by
'PAYMENTREQUEST_0_PAYMENTACTION' => 'Sale',
When you set the PAYMENTREQUEST_0_PAYMENTACTION to 'Authorization' , means that you are asking PayPal to check whether the funds are available, and if they are, to place a hold on them for 72 hours. You have up to 29 days to capture an authorization, and when you do, the funds are on hold for three days only. The first 72 hours of the 29-day period are known as the "honor period", meaning that PayPal guarantees that the funds are available.
The three-day hold occurs in most cases, depending on the
card-issuing bank, or the bank itself in ACH transactions, such as a
debit card. In some cases, the three-day hold is waived, whereas in
other cases there may be a hold on the card for up to 30 days or
until the next billing cycle.
If you decide to capture the funds within the last three days of the
29-day period, those funds are held until the end of the 29th day
instead of the usual three days.
You can capture less than the original authorization amount, the full
amount, or up to 115% of or $75 more than the original authorization,
whichever is less.
And when you set the PAYMENTREQUEST_0_PAYMENTACTION to 'Sale' , the payment is processed without holding the funds. The funds are transferred from the buyer's funding source to your PayPal account balance immediately.
You would use the 'Sale' option for something that is delivered
quickly, such as digital goods or a product that ships as soon as you
receive the order.
The funds are immediately taken from the buyer's funding source and
sent to your PayPal account balance.

Categories