-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Endpoint did not accept the request. (Code: 422) #44
Comments
Hi @ayafaheem , You can always catch CheckoutHttpException exception, print |
Same here, The endpoint did not accept the request. (Code: 422) |
Hi @Amaraciuri , |
Are your payment credentials valid? Check if you are sending request to sandbox or live |
Same issue with me. My Secret key and cart token is correct. Did anyone found the solution?
|
@iamsajidjaved , Try wrapping
Here's a link about error handling of the PHP SDK: https://github.com/checkout/checkout-sdk-php/wiki#error-handling |
I am facing the same issue is it because I am using the sandbox endpoint ? |
@Paula2001 , |
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 . |
@everyone I faced this issue was because of 2 reasons and I found them when
I used to try and catch:
- I were not passing *CSRF* in AJAX/AXIOS to Laravel
- I have copied and used the HTML form/page from the Checkout.com
documentation and there is a *random token in JS Section*. Replace it by
your own.
Maybe you are facing another issue. Please try to you *Try and Catch Block*
…On Tue, 14 Apr 2020 at 03:28, Paula George ***@***.***> wrote:
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 .
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#44 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AH2AU5DSEG45D2TBYXYRPQTRMOGXHANCNFSM4J4KBQEQ>
.
--
Regards:
Engr. Sajid Javed(Web & Mobile Apps Developer)
engr.maliksajidkhan@gmail.com | +971 503973612
|
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'); |
worth to mention that I am using the testing account |
Can you paste your function here?
My PHP Function
// Set the secret key
$secretKey = 'SECRET_KEY_._GET_THIS_FROM_YOUR_ACCOUNT';
// Initialize the Checkout API
$checkout = new CheckoutApi($secretKey);
// Create a payment method instance with card details
$method = new TokenSource($request->token);
// Prepare the payment parameters
$payment = new Payment($method, 'GBP');
$payment->amount = 1000; // = 10.00
try {
$response = $checkout->payments()->request($payment);
dd($response);
} catch (Checkout\Library\Exceptions\CheckoutHttpException $ex) {
dd($ex->getBody());
}
…On Tue, 14 Apr 2020 at 16:34, Paula George ***@***.***> wrote:
worth to mention that I am using the testing account
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#44 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AH2AU5F6RQ7CYQCVLYLQCADRMRC4RANCNFSM4J4KBQEQ>
.
--
Regards:
Engr. Sajid Javed(Web & Mobile Apps Developer)
engr.maliksajidkhan@gmail.com | +971 503973612
|
My JS CODE
<script>
var payButton = document.getElementById("pay-button");
var form = document.getElementById("payment-form");
Frames.init("PUBLIC_KEY.GET_IT_FROM_YOUR_ACCOUNT");
Frames.addEventHandler(
Frames.Events.CARD_VALIDATION_CHANGED
, function(event) {
console.log("CARD_VALIDATION_CHANGED: %o", event);
payButton.disabled = !Frames.isCardValid();
}
);
Frames.addEventHandler(
Frames.Events.CARD_TOKENIZED
, function(event) {
var url = "<?php echo url('checkout'); ?>";
$.ajax(url, {
type: 'POST', // http method
data: {
token: event.token,
_token: "{{ csrf_token() }}",
}
, success: function(data, status, xhr) { // success callback function
console.log('success');
}
, error: function(jqXhr, textStatus, errorMessage) { // error callback
console.log('error');
}
});
}
);
form.addEventListener("submit", function(event) {
event.preventDefault();
Frames.submitCard();
});
</script>
On Tue, 14 Apr 2020 at 17:00, Malik Sajid <engr.maliksajidkhan@gmail.com>
wrote:
… Can you paste your function here?
My PHP Function
// Set the secret key
$secretKey = 'SECRET_KEY_._GET_THIS_FROM_YOUR_ACCOUNT';
// Initialize the Checkout API
$checkout = new CheckoutApi($secretKey);
// Create a payment method instance with card details
$method = new TokenSource($request->token);
// Prepare the payment parameters
$payment = new Payment($method, 'GBP');
$payment->amount = 1000; // = 10.00
try {
$response = $checkout->payments()->request($payment);
dd($response);
} catch (Checkout\Library\Exceptions\CheckoutHttpException $ex) {
dd($ex->getBody());
}
On Tue, 14 Apr 2020 at 16:34, Paula George ***@***.***>
wrote:
> worth to mention that I am using the testing account
>
> —
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub
> <#44 (comment)>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AH2AU5F6RQ7CYQCVLYLQCADRMRC4RANCNFSM4J4KBQEQ>
> .
>
--
Regards:
Engr. Sajid Javed(Web & Mobile Apps Developer)
***@***.*** | +971 503973612
--
Regards:
Engr. Sajid Javed(Web & Mobile Apps Developer)
engr.maliksajidkhan@gmail.com | +971 503973612
|
This is my code and its working for me
On Tue, 14 Apr 2020 at 17:01, Malik Sajid <engr.maliksajidkhan@gmail.com>
wrote:
… My JS CODE
<script>
var payButton = document.getElementById("pay-button");
var form = document.getElementById("payment-form");
Frames.init("PUBLIC_KEY.GET_IT_FROM_YOUR_ACCOUNT");
Frames.addEventHandler(
Frames.Events.CARD_VALIDATION_CHANGED
, function(event) {
console.log("CARD_VALIDATION_CHANGED: %o", event);
payButton.disabled = !Frames.isCardValid();
}
);
Frames.addEventHandler(
Frames.Events.CARD_TOKENIZED
, function(event) {
var url = "<?php echo url('checkout'); ?>";
$.ajax(url, {
type: 'POST', // http method
data: {
token: event.token,
_token: "{{ csrf_token() }}",
}
, success: function(data, status, xhr) { // success callback function
console.log('success');
}
, error: function(jqXhr, textStatus, errorMessage) { // error callback
console.log('error');
}
});
}
);
form.addEventListener("submit", function(event) {
event.preventDefault();
Frames.submitCard();
});
</script>
On Tue, 14 Apr 2020 at 17:00, Malik Sajid ***@***.***>
wrote:
> Can you paste your function here?
>
> My PHP Function
>
> // Set the secret key
> $secretKey = 'SECRET_KEY_._GET_THIS_FROM_YOUR_ACCOUNT';
>
> // Initialize the Checkout API
> $checkout = new CheckoutApi($secretKey);
>
> // Create a payment method instance with card details
> $method = new TokenSource($request->token);
>
> // Prepare the payment parameters
> $payment = new Payment($method, 'GBP');
> $payment->amount = 1000; // = 10.00
>
> try {
> $response = $checkout->payments()->request($payment);
> dd($response);
> } catch (Checkout\Library\Exceptions\CheckoutHttpException $ex) {
> dd($ex->getBody());
> }
>
> On Tue, 14 Apr 2020 at 16:34, Paula George ***@***.***>
> wrote:
>
>> worth to mention that I am using the testing account
>>
>> —
>> You are receiving this because you were mentioned.
>> Reply to this email directly, view it on GitHub
>> <#44 (comment)>,
>> or unsubscribe
>> <https://github.com/notifications/unsubscribe-auth/AH2AU5F6RQ7CYQCVLYLQCADRMRC4RANCNFSM4J4KBQEQ>
>> .
>>
>
>
> --
> Regards:
> Engr. Sajid Javed(Web & Mobile Apps Developer)
> ***@***.*** | +971 503973612
>
--
Regards:
Engr. Sajid Javed(Web & Mobile Apps Developer)
***@***.*** | +971 503973612
--
Regards:
Engr. Sajid Javed(Web & Mobile Apps Developer)
engr.maliksajidkhan@gmail.com | +971 503973612
|
thanks appreciate your share |
Hello dear ,
I'm having an issue in the checkout-sdk-php when payments using apple pay
after pay using apple pay and Create a Apple Pay token then Create new payment method this error appear to me .
Checkout\Library\Exceptions\CheckoutHttpException: The endpoint did not accept the request. (Code: 422) in vendor/checkout/checkout-sdk-php/src/Library/HttpHandler.php:327
Any one can help me to fix this bug ??
The text was updated successfully, but these errors were encountered: