Skip to content
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

Receiving error: payment_method_not_supported #226

Open
adamjimenez opened this issue Nov 3, 2023 · 18 comments
Open

Receiving error: payment_method_not_supported #226

adamjimenez opened this issue Nov 3, 2023 · 18 comments
Assignees
Labels
help wanted Extra attention is needed

Comments

@adamjimenez
Copy link

I'm using the test card details and receive the error payment_method_not_supported when attempting a transaction in our test account.

Ths is an abridged version of my code:

        $requestTokenSource = new RequestTokenSource();
        $requestTokenSource->token = $token; // Token is posted from card form
		
        $threeDsRequest = new ThreeDsRequest();
        $threeDsRequest->enabled = true;
		
        $paymentInstrumentSender = new PaymentInstrumentSender();

        $paymentRequest = new PaymentRequest();
        $paymentRequest->source = $requestTokenSource;
        $paymentRequest->capture = true;
        $paymentRequest->capture_on = date('c', strtotime('tomorrow'));  // ISO 8601 e.g. "2019-09-10T10:11:12Z",
        $paymentRequest->reference = $ref;
        $paymentRequest->amount = $amount * 100;
        $paymentRequest->currency = Currency::$GBP;
        $paymentRequest->sender = $paymentInstrumentSender;
        $paymentRequest->three_ds = $threeDsRequest;
        $paymentRequest->success_url = 'https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
        $paymentRequest->failure_url = 'https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
        $paymentRequest->metadata = $metadata;
        $paymentRequest->processing_channel_id = 'pc_nfv2zwctplcejmdirobdx5abty';
		
	$customerRequest = new CustomerRequest();
	$customerRequest->email = $user['email'];
	$customerRequest->name = $user['name'] . ' ' . $user['surname'];
    	$paymentRequest->customer = $customerRequest;
	
    	$paymentResponse = $this->api->getPaymentsClient()->requestPayment($paymentRequest);
@armando-rodriguez-cko armando-rodriguez-cko self-assigned this Nov 3, 2023
@armando-rodriguez-cko
Copy link
Contributor

Hi @adamjimenez! We will take a look and get back to you as soon as possible. Thank you.

@armando-rodriguez-cko armando-rodriguez-cko added the help wanted Extra attention is needed label Nov 3, 2023
@armando-rodriguez-cko
Copy link
Contributor

Hi @adamjimenez!
Sandbox accounts come enabled for Visa and Mastercard tests only, if you need to enable other schemes, you need to be done in the account config, please check your test card(s).

@armando-rodriguez-cko
Copy link
Contributor

Hi @adamjimenez, we close this issue due to inactivity, if you need it, please open a new issue. Thank you.

@adamjimenez
Copy link
Author

Hi @adamjimenez, we close this issue due to inactivity, if you need it, please open a new issue. Thank you.

So it takes you 3 weeks to respond and you give me 2 days?

@armando-rodriguez-cko
Copy link
Contributor

armando-rodriguez-cko commented Nov 23, 2023

Hi @adamjimenez, we apologise, we reopen this issue, you can now publish a new comments.

@adamjimenez
Copy link
Author

adamjimenez commented Nov 23, 2023

In answer to your question, I'm using the visa test card 4242424242424242 from the test cards list.

@armando-rodriguez-cko
Copy link
Contributor

Thank you @adamjimenez. We are testing your example and the data. At the same time, please check in the SDK tests, there are some examples with 3DS.

@armando-rodriguez-cko
Copy link
Contributor

Hi @adamjimenez! Happy new year. Please try this:

<?php

use Checkout\CheckoutApiException;
use Checkout\CheckoutSdk;
use Checkout\Common\Currency;
use Checkout\Common\CustomerRequest;
use Checkout\Environment;
use Checkout\Payments\Request\PaymentRequest;
use Checkout\Payments\Request\Source\RequestTokenSource;
use Checkout\Payments\Sender\PaymentInstrumentSender;
use Checkout\Payments\ThreeDsRequest;
use Checkout\Tokens\CardTokenRequest;

require __DIR__ . '/vendor/autoload.php';

$CheckoutAPI = CheckoutSdk::builder()->staticKeys()
    ->publicKey("pk_sbox_xxxx")
    ->secretKey('sk_sbox_xxxx')
    ->environment(Environment::sandbox())
    ->build();

$cardTokenRequest = new CardTokenRequest();
$cardTokenRequest->number = "4242424242424242";
$cardTokenRequest->expiry_month = 6;
$cardTokenRequest->expiry_year = 2025;

try {
    $tokenResponse = $CheckoutAPI->getTokensClient()->requestCardToken($cardTokenRequest);

    $requestTokenSource = new RequestTokenSource();
    $requestTokenSource->token = $tokenResponse["token"];

    $threeDsRequest = new ThreeDsRequest();
    $threeDsRequest->enabled = true;

    $paymentInstrumentSender = new PaymentInstrumentSender();

    $customerRequest = new CustomerRequest();
    $customerRequest->email = $user['email'];
    $customerRequest->name = $user['name'] . ' ' . $user['surname'];

    $paymentRequest = new PaymentRequest();
    $paymentRequest->source = $requestTokenSource;
    $paymentRequest->amount = $amount * 100;
    $paymentRequest->currency = Currency::$GBP;
    $paymentRequest->capture = true;
    $paymentRequest->capture_on = date('c', strtotime('tomorrow'));  // ISO 8601 e.g. "2019-09-10T10:11:12Z",
    $paymentRequest->reference = $ref;
    $paymentRequest->three_ds = $threeDsRequest;
    $paymentRequest->sender = $paymentInstrumentSender;
    $paymentRequest->customer = $customerRequest;
    $paymentRequest->processing_channel_id = 'pc_xxxx';
    $paymentRequest->metadata = $metadata;
    $paymentRequest->success_url = 'https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
    $paymentRequest->failure_url = 'https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];

    try {
        $response = $CheckoutAPI->getPaymentsClient()->requestPayment($paymentRequest);
        print_r($response);
        exit;
    } catch (Exception $ex) {
        print_r($ex->getMessage());
    }

} catch (CheckoutApiException $ex) {
    print_r($ex->getMessage());
}
exit;

This is the response with my credentials and processing channel:

Array
(
    [http_metadata] => Checkout\HttpMetadata Object
        (
            [reason_phrase:Checkout\HttpMetadata:private] => Accepted
            [status_code:Checkout\HttpMetadata:private] => 202
            [headers:Checkout\HttpMetadata:private] => Array
                (
                    [Date] => Array
                        (
                            [0] => Fri, 12 Jan 2024 10:01:51 GMT
                        )

                    [Content-Type] => Array
                        (
                            [0] => application/json; charset=utf-8
                        )

                    [Content-Length] => Array
                        (
                            [0] => 542
                        )

                    [Connection] => Array
                        (
                            [0] => keep-alive
                        )

                    [Location] => Array
                        (
                            [0] => https://api.sandbox.checkout.com/payments/pay_xxxx
                        )

                    [Cko-Request-Id] => Array
                        (
                            [0] => xxxx-xxxx-xxxx-xxxx
                        )

                    [Cko-Version] => Array
                        (
                            [0] => 1.344.1+e6797bc63
                        )

                    [Strict-Transport-Security] => Array
                        (
                            [0] => max-age=16000000; includeSubDomains; preload;
                        )

                )

            [protocol:Checkout\HttpMetadata:private] => 1.1
        )

    [id] => pay_xxxx
    [status] => Pending
    [reference] => xxxx
    [customer] => Array
        (
            [id] => cus_xxxx
            [email] => email
            [name] => name
        )

    [3ds] => Array
        (
            [downgraded] => 
            [enrolled] => Y
        )

    [_links] => Array
        (
            [self] => Array
                (
                    [href] => https://api.sandbox.checkout.com/payments/pay_xxxx
                )

            [actions] => Array
                (
                    [href] => https://api.sandbox.checkout.com/payments/pay_xxxx/actions
                )

            [redirect] => Array
                (
                    [href] => https://api.sandbox.checkout.com/sessions-interceptor/sid_xxxx
                )

        )

)

@adamjimenez
Copy link
Author

Hi,

Thanks for the reply.
I've tried the code and am still getting the same 422 error.

I did a composer update and we're on 3.0.20 version of the sdk.

I checked the keys and processing id which appear to be correct.

Is there any way to get more information on this error?

@armando-rodriguez-cko
Copy link
Contributor

Hi @adamjimenez!

Debugging you can find a detailed error in:

image

image

@adamjimenez
Copy link
Author

adamjimenez commented Jan 16, 2024 via email

@armando-rodriguez-cko
Copy link
Contributor

@adamjimenez
Copy link
Author

adamjimenez commented Jan 16, 2024 via email

@adamjimenez
Copy link
Author

I'm not sure if that link applies. How do we enable 3ds in the sandbox area?

@armando-rodriguez-cko
Copy link
Contributor

@inikoo
Copy link

inikoo commented Mar 18, 2024

That documentation is nothing to do with the problem, he is using the test card 4242424242424242 , that documentations is for issuing other cards

@lrotherfield-function
Copy link

lrotherfield-function commented Apr 2, 2024

I too am receiving 422 responses using the sandbox. Here is a request payload:

URL: https://api.sandbox.checkout.com/payments

{
  "source": {
    "type": "token",
    "token": "***",
    "billing_address": {
      "address_line1": "***",
      "address_line2": "",
      "city": "***",
      "state": "***",
      "zip": "00000",
      "country": "AE"
    }
  },
  "amount": 159600,
  "currency": "AED",
  "payment_type": "Regular",
  "reference": "AE200005095",
  "description": "Payment request from ***",
  "capture": true,
  "capture_on": "2024-04-02T15:01:30Z",
  "customer": {
    "email": "***",
    "name": "***"
  },
  "shipping": {
    "address": {
      "address_line1": "***",
      "address_line2": "",
      "city": "***",
      "state": "***",
      "zip": "00000",
      "country": "AE"
    }
  },
  "3ds": {
    "enabled": true,
    "attempt_n3d": false
  },
  "processing_channel_id": "pc_jot***",
  "success_url": "***/checkout_com\/payment\/verify",
  "failure_url": "***/checkout_com\/payment\/fail",
  "metadata": {
    "methodId": "checkoutcom_card_payment",
    "quoteData": "{\"quote_id\":\"3079662\",\"store_id\":13,\"customer_email\":\"***\"}",
    "udf5": "{\"server_url\":\"***\",\"sdk_data\":\"PHP v8.1.14, SDK v3.0.6\",\"integration_data\":\"Checkout.com Magento 2 Module v5.2.0\",\"platform_data\":\"Magento 2.4.6-p4\"}"
  }
}

And the response:

{
  "request_id": "108aacaa-095b-4679-a7b5-6eedac4bab60",
  "error_type": "processing_error",
  "error_codes": [
    "payment_method_not_supported"
  ]
}

I used the following card details:

5588686116426417
03/30
100

I have tried the visa 3DS enabled test card 4485040371536584 and the standard visa test card 4242424242424242. Both times with the expiry date 03/30 and CVV 100. I receive the same response as above with these cards too.

@armando-rodriguez-cko
Copy link
Contributor

Hi @lrotherfield-function this URL is in production, we can verify it, please contact checkout support at [email protected]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Development

No branches or pull requests

4 participants