Giter Club home page Giter Club logo

Comments (16)

iamsajidjaved avatar iamsajidjaved commented on July 17, 2024 1

from checkout-sdk-php.

aquila-freitas-cko avatar aquila-freitas-cko commented on July 17, 2024

Hi @ayafaheem ,
Error 422 is a gateway response for invalid data sent. Double check if Apple data is well decoded when sending to your PHP file from the front-end.

You can always catch CheckoutHttpException exception, print $e->getErrors(); or $e->getBody(); to help you on debugging.

from checkout-sdk-php.

Amaraciuri avatar Amaraciuri commented on July 17, 2024

Same here, The endpoint did not accept the request. (Code: 422)

from checkout-sdk-php.

aquila-freitas-cko avatar aquila-freitas-cko commented on July 17, 2024

Hi @Amaraciuri ,
I believe you are sending invalid data to the gateway. Could you catch the error and see what field is invalid?

from checkout-sdk-php.

therajibhossain avatar therajibhossain commented on July 17, 2024

Are your payment credentials valid? Check if you are sending request to sandbox or live

from checkout-sdk-php.

iamsajidjaved avatar iamsajidjaved commented on July 17, 2024

Same issue with me. My Secret key and cart token is correct. Did anyone found the solution?

 public function store(Request $request)
    {

// Initialize the Checkout API
        $checkout = new CheckoutApi('sk_test_b5065bb5-f1b1-4dd3-b21a-bd9f2d99375b');

// Create a payment method instance with card details
        $method = new TokenSource("$request->checkout_token");

// Prepare the payment parameters
        $payment = new Payment($method, 'GBP');
        $payment->amount = 10000; // = 10.00

// Send the request and retrieve the response
        $response = $checkout->payments()->request($payment);

        dd($response);
    }

from checkout-sdk-php.

aquila-freitas-cko avatar aquila-freitas-cko commented on July 17, 2024

@iamsajidjaved ,
I've tried to run your example and is working fine. Error code 422 means you are sending invalid data to the gateway (see more here).

Try wrapping $response = $checkout->payments()->request($payment); with a try-catch and see what data is invalid. Here's an example:

try {
            $response = $checkout->payments()->request($payment);
} catch(Checkout\Library\Exceptions\CheckoutHttpException $ex) {
            print_r($ex->getBody());
}

Here's a link about error handling of the PHP SDK: https://github.com/checkout/checkout-sdk-php/wiki#error-handling

from checkout-sdk-php.

Paula2001 avatar Paula2001 commented on July 17, 2024

I am facing the same issue is it because I am using the sandbox endpoint ?

from checkout-sdk-php.

aquila-freitas-cko avatar aquila-freitas-cko commented on July 17, 2024

@Paula2001 ,
There are many reasons why gateway can respond with 422. You will find more details in the reference.

from checkout-sdk-php.

Paula2001 avatar Paula2001 commented on July 17, 2024

I've read this several times already and the data is correct ,The only thing left is that I am using the testing token and I want to know if there's a proof that supports that .

from checkout-sdk-php.

Paula2001 avatar Paula2001 commented on July 17, 2024

I am getting "Your API key is invalid." and I double checked the token also there's something I don't understand $method = new TokenSource('tok_ubfj2q76miwundwlk72vxt2i7q');
what's that @iamsajidjaved

from checkout-sdk-php.

Paula2001 avatar Paula2001 commented on July 17, 2024

worth to mention that I am using the testing account

from checkout-sdk-php.

iamsajidjaved avatar iamsajidjaved commented on July 17, 2024

from checkout-sdk-php.

iamsajidjaved avatar iamsajidjaved commented on July 17, 2024

from checkout-sdk-php.

iamsajidjaved avatar iamsajidjaved commented on July 17, 2024

from checkout-sdk-php.

Paula2001 avatar Paula2001 commented on July 17, 2024

thanks appreciate your share

from checkout-sdk-php.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.