Why is still trying to contact sandbox?

tam2000k2
Contributor
Contributor

I have pushed my code to the production server. In my first attempt to pay, the response is returning the following:

 

{"name":"MALFORMED_REQUEST","message":"Incoming JSON request does not map to API request","information_link":"https://developer.paypal.com/webapps/developer/docs/api/#MALFORMED_REQUEST","debug_id":"16216e721b6e9"}

sandbox-domain.png

 

The previous screen shot shows that sandbox is still the target, but I have changed the following to point to production:

 

  paypalConfig = {
    env: "sandbox",
    client: {
      sandbox:
        "sandbox-key",
      production:
        "prod-key"
    },

      const payPalSrvcCloned = req.clone({
        headers: req.headers.set(
          "Authorization",
          "Bearer " + this.payPalSrvc.getToken()
        )
      });

The first snippet has actual keys in the code, but I am displaying them here and the second snippet returns the secret for production in the header.

 

On top of that question, there is an error of the following:

 

Error: Request to post https://www.sandbox.paypal.com/v1/payments/payment failed with 400 error. Correlation id: 16216e721b6e9, 16216e721b6e9

{
    "name": "MALFORMED_REQUEST",
    "message": "Incoming JSON request does not map to API request",
    "information_link": "https://developer.paypal.com/webapps/developer/docs/api/#MALFORMED_REQUEST",
    "debug_id": "16216e721b6e9"
}

Am I receiving this error because it is posting to sandbox and, if so, how do I change it to point to production? I thought that all I needed was to provide the production client id and send Authorization and Bearer in the header. Am i mistaken? If so, then please tell me what I am missing, because this Angular 6 app was working perfectly in the dev environment? But then again, in dev, I had everything pointing to the sandbox credentials.

 

Thanks in advance,

Login to Me Too
0 REPLIES 0

Haven't Found your Answer?

It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.