Sandbox buyer account with balance not working (PAYER_CANNOT_PAY)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I'm using Paypal's PHP SDK, but I'm having trouble with executing payments (400, error code: PAYER_CANNOT_PAY ).
Sandbox setup:
1. Created a business sandbox account
2. Created a developer account
3. Created an App
4. Created sandbox buyer accounts with balance and linked credit card
Code:
1. Create a payment with Paypal SDK
$cred = new OAuthTokenCredential("$clientID", "$secret", $sdkConfig); $cred->accessToken = $cred->getAccessToken($sdkConfig); $apiContext = new ApiContext($cred); $payer = new Payer(); $payer->setPaymentMethod("paypal"); $item1 = new Item(); $item1->setName('Ground Coffee 40 oz') ->setCurrency('USD') ->setQuantity(1) ->setSku("123123") // Similar to `item_number` in Classic API ->setPrice(7.5); $item2 = new Item(); $item2->setName('Granola bars') ->setCurrency('USD') ->setQuantity(5) ->setSku("321321") ->setPrice(2); $itemList = new ItemList(); $itemList->setItems(array($item1, $item2)); $details = new Details(); $details->setShipping(1.2) ->setTax(1.3) ->setSubtotal(17.50); $amount = new Amount(); $amount->setCurrency("USD") ->setTotal(20) ->setDetails($details); $transaction = new Transaction(); $transaction->setAmount($amount) ->setItemList($itemList) ->setDescription("Payment description") ->setInvoiceNumber(uniqid()); $redirectUrls = new RedirectUrls(); $redirectUrls->setReturnUrl("http://test.dev/paypal?success=true") ->setCancelUrl("http://test.dev/paypal?success=false"); $payment = new Payment(); $payment->setIntent("sale") ->setPayer($payer) ->setRedirectUrls($redirectUrls) ->setTransactions(array($transaction)); $request = clone $payment; $payment->create($apiContext);
2. App redirects user to Paypal sandbox login page
3. Login with sandbox account (Pay with section is empty)
4. User is redirected back with token, paymentID, payerID and status(success)
5. Execute the payment <-- response from API 400, PAYER_CANNOT_PAY
$paymentId = $request->all()['paymentId']; $payment = Payment::get($paymentId, $apiContext); $execution = new PaymentExecution(); $execution->setPayerId($request->all()['PayerID']); $payment->execute($execution, $apiContext);
Error:
{ "status": 400, "duration_time": 156, "body": { "message": "The combination of payer and payee settings mean that this buyer can't pay this seller.", "debug_id": "debugid", "details": [], "name": "PAYER_CANNOT_PAY", "information_link": "https://developer.paypal.com/docs/api/payments/#errors" }, }
Any idea why this is failing?
Thank you in advance!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Could be the verification or confirmation setup on the buyer or seller account, can you post the debug ID and we'll check it out.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
HTTP/1.1 400 Bad Request Date: Thu, 01 Au[Removed. Phone #s not permitted]GMT Server: Apache paypal-debug-id: f464799c155d8 Content-Language: * Connection: close HTTP_X_PP_AZ_LOCATOR: sandbox.slc Paypal-Debug-Id: f464799c155d8 Set-Cookie: X-PP-SILOVER=name%3DSANDBOX3.API.1%26silo_version%3D1880%26app%3Dapiplatformproxyserv%26TIME%3D787432029%26HTTP_X_PP_AZ_LOCATOR%3Dsandbox.slc; Expires=Thu, 01 Au[Removed. Phone #s not permitted]GMT; domain=.paypal.com; path=/; Secure; HttpOnly Set-Cookie: X-PP-SILOVER=; Expires=Thu, 01 Jan 1970 00:00:01 GMT Vary: Authorization Content-Length: 243 Content-Type: application/json {"name":"PAYER_CANNOT_PAY","details":[],"message":"The combination of payer and payee settings mean that this buyer can't pay this seller.","information_link":"https://developer.paypal.com/docs/api/payments/#errors","debug_id":"f464799c155d8"}1Array ( [url] => https://api.sandbox.paypal.com/v1/payments/payment [content_type] => application/json [http_code] => 400 [header_size] => 600 [request_size] => 948 [filetime] => -1 [ssl_verify_result] => 0 [redirect_count] => 0 [total_time] => 5.921331 [namelookup_time] => 3.2E-5 [connect_time] => 0.000428 [pretransfer_time] => 2.960278 [size_upload] => 584 [size_download] => 243 [speed_download] => 41 [speed_upload] => 98 [download_content_length] => 243 [upload_content_length] => 584 [starttransfer_time] => 5.921304 [redirect_time] => 0 [redirect_url] => [primary_ip] => 173.0.82.78 [certinfo] => Array ( ) [primary_port] => 443 [local_ip] => 192.168.1.3 [local_port] => 32846 [request_header] => POST /v1/payments/payment HTTP/1.1 Host: api.sandbox.paypal.com Accept: */* Content-Type: application/json PayPal-Client-Metadata-Id: LVwVAPmGNmmpNEAVh5FkY5SvmY8Rc-J3zJSJwtBQQXBwnYPTxVrwXsgO7hUlHh1KPw9_v8NN9nePQ53t Authorization: Bearer A23AAHs5jVWmLQcdc_RtA09yWEsqXsFyLn4Nzd9iPIhFnOy7knjjutOHW6AAgYIZJc20NjtAP54DmPek6W0CCGOTMfcpnw80A Content-Length: 584 )
Haven't Found your Answer?
It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.
- My webhook stopped working 2 weeks ago in REST APIs
- PayPal Native checkout card errors in Sandbox Environment
- Is there a payout Transaction ID that links to the transactions that are feeding it? in PayPal Reporting
- PayPal subscription payment fails after payment with insufficient funds in Sandbox Environment
- All of our test accounts are failing in Sandbox Environment