PayPal Vault Payment: Getting 400 Bad Request error on Sandbox account

71 Views Asked by At

Starging fresh, I logged on to paypal.com and went to the Developer Dashboard.

I created a new app there called, CADESandboxApp. Selected “Merchant” type and sandbox account, [email protected]. I used the following creds (numbers changed and deleted from real ones)

Client ID:AaSu-f_n5N89gp_sjHNeIHPH-tUWbn4R-kHoNvWu2tR6NZJPLyx1dhj0lYx51Jw494e9Md18mcHaHu
Secret:EBqYRx-Lenb4jIcw5_Grs8Kr3jmbB2hdQnwyrNj8qLQl2QbiDi8X8NnRURZmkzUo9GXaoQnxdT0kc
In Features: vault, subscriptions, native checkout SDK, and invoicing are checked and saved

Make a vault payment and get the error:

General The remote server returned an error: (400) Bad Request.
Error: PAYEE_ACCOUNT_INVALID
Message: Payee account is invalid.
URI: https://developer.paypal.com/docs/api/payments/v1/#error-PAYEE_ACCOUNT_INVALID

I verified the creds and was using what I've shown. Code which causes error:

var createdPayment = payment.Create(ppc.apiContext);

ppc.apiContext.config values
    [0]: {[mode, sandbox]}
    [1]: {[clientId, AaSu-f_n5N89gp_sjHNeIHPH-tUWbn4R-kHoNvWu2tR6NZJPLyx1dhj0lYx51Jw494e9Md18mcHaHu]}
    [2]: {[clientSecret, EBqYRx-Lenb4jIcw5_Grs8Kr3jmbB2hdQnwyrNj8qLQl2QbiDi8X8NnRURZmkzUo9GXaoQnxdT0kc]}

Here is the request:

{
  "intent": "sale",
  "payer": {
    "funding_instruments": [
      {
        "credit_card_token": {
          "credit_card_id": "CARD-617234197E5556435MSYQZ6A",
          "expire_month": 3,
          "expire_year": 2027,
          "last4": "xxxxxxxxxxx4004",
          "payer_id": "701",
          "type": "amex"
        }
      }
    ],
    "payer_info": {
      "email": "*****",
      "payer_id": "lutzie43"
    },
    "payment_method": "credit_card"
  },
  "transactions": [
    {
      "amount": {
        "currency": "USD",
        "details": {
          "shipping": "0",
          "subtotal": "10.00",
          "tax": "0"
        },
        "total": "10.00"
      },
      "description": "1xLutzie-43 Safe Driving Habit-Builder - Annual\r\n\r\n  $10.00",
      "invoice_number": "68805",
      "item_list": {
        "items": [
          {
            "currency": "USD",
            "name": "1xLutzie-43 Safe Driving Habit-Builder - Annual\r\n\r\n  $10.00",
            "price": "10.00",
            "quantity": "1",
            "sku": "sku"
          }
        ],
        "shipping_address": {
          "city": "Woodstock",
          "country_code": "US",
          "line1": "117 xxxxxx",
          "line2": "*****",
          "postal_code": "30188",
          "recipient_name": "*****",
          "state": "GA"
        }
      },
      "payee": {
        "email": "*****",
        "merchant_id": "W7SYLKMYANP2S"
      }
    }
  ]
}

What am I doing wrong?

0

There are 0 best solutions below