Level 1
up
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hi people;
I want to use paypal for my website, and for my payments I can use my credit card, and people can use credit card that could be not verified by paypal.
I'm setting my omnipay like this :
public function paiement()
{
$gateway = Omnipay::create('PayPal_Rest');
$gateway->initialize(array(
'clientId' => '********',
'secret' => '***********',
'testMode' => false, // Or false when you are ready for live transactions
));
$transaction = $gateway->authorize(array(
'returnUrl'=> route('order'),
'cancelUrl' => route('acceuil'),
'amount' => 12.99,
'currency' => 'EUR',
'description' => 'This is a test authorize transaction.',
// 'card' => $card,
));
$response = $transaction->send();
if ($response->isRedirect()) {
// Yes it's a redirect. Redirect the customer to this URL:
$redirectUrl = $response->getRedirectUrl();
return redirect($redirectUrl);
}
}
& my order is like this :
public function order(Guard $user)
{
$gateway = Omnipay::create('PayPal_Rest');
$gateway->initialize(array(
'clientId' => '******************',
'secret' => '*********************',
'testMode' => false, // Or false when you are ready for live transactions
));
$response = $gateway->completePurchase(array(
'payerId' => $_GET['PayerID'],
'transactionReference' => $_GET['paymentId'],
));
$finalResponse = $response->send();
dd($finalResponse);
There is three isues :
RestResponse {#386 ▼
#statusCode: 400
#request: RestCompletePurchaseRequest {#388 ▶}
#data: array:5 [▼
"name" => "INSTRUMENT_DECLINED"
"details" => []
"message" => "The instrument presented was either declined by the processor or bank, or it can't be used for this payment."
"information_link" => "https://developer.paypal.com/docs/api/payments/#errors"
"debug_id" => "638b4fd83c366"
]
}
Well, I don't understand why it's doing that.. Maybe it's because the website is not in https ?
If you have an idea about why i'm having this only because the credit card isn't verified by paypal, I would like to have my clients doing this even without a verified credit card or a guest account.
Well, thank you in advance
Please or to participate in this conversation.