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.
Related
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
I have integrated paypal payment in my project .
I would like to include automatic refund option.
require_once('includes/paypal.class.php');
require_once('includes/paypal.adaptive.class.php');
include('includes/config.php');
// Create PayPal object.
$PayPalConfig = array(
'Sandbox' => $sandbox,
'DeveloperAccountEmail' => $developer_account_email,
'ApplicationID' => $application_id,
'DeviceID' => $device_id,
'IPAddress' => $_SERVER['REMOTE_ADDR'],
'APIUsername' => $api_username,
'APIPassword' => $api_password,
'APISignature' => $api_signature,
'APISubject' => $api_subject
);
$PayPal = new PayPal_Adaptive($PayPalConfig);
// Prepare request arrays
$RefundFields = array(
'CurrencyCode' => USD',
// Required. Must specify code used for original payment. You do not need to specify if you use a payKey to refund a completed transaction.
'PayKey' => '',
// Required. The key used to create the payment that you want to refund.
'TransactionID' => '7C0359353Y165821P',
// Required. The PayPal transaction ID associated with the payment that you want to refund.
'TrackingID' => ''
// Required. The tracking ID associated with the payment that you want to refund.
);
$Receivers = array();
$Receiver = array(
'Email' => 'jilu#newagesmb.com',
// A receiver's email address.
'Amount' => '100.00',
// Amount to be debited to the receiver's account.
'Primary' => '',
// Set to true to indicate a chained payment. Only one receiver can be a primary receiver. Omit this field, or set to false for simple and parallel payments.
'InvoiceID' => '',
'PaymentType' => 'GOODS'
// The transaction subtype for the payment. Allowable values are: GOODS, SERVICE
);
array_push($Receivers, $Receiver);
$PayPalRequestData = array(
'RefundFields' => $RefundFields,
'Receivers' => $Receivers
);
//print_r($PayPalRequestData);exit;
$PayPalResult = $PayPal->Refund($PayPalRequestData);
echo '<pre />';
print_r($PayPalResult);
My Output is:
2014-04-28T02:54:20.805-07:00Failure55b35d9b576e810680030560022PLATFORMApplicationErrorApplicationThe X-PAYPAL-APPLICATION-ID header contains an invalid valueX-PAYPAL-APPLICATION-ID
Did your application fully approved via PayPal?
You can check it from below link:
https://www.paypal-apps.com/user/my-account/applications
You can use application ID if it has been fully approved via PayPal. You can try this after confirmation from above URL.
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";
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
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"
)
)
);