Giter Club home page Giter Club logo

Comments (17)

armando-rodriguez-cko avatar armando-rodriguez-cko commented on July 17, 2024 1

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

from checkout-sdk-php.

armando-rodriguez-cko avatar armando-rodriguez-cko commented on July 17, 2024

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

from checkout-sdk-php.

armando-rodriguez-cko avatar armando-rodriguez-cko commented on July 17, 2024

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).

from checkout-sdk-php.

armando-rodriguez-cko avatar armando-rodriguez-cko commented on July 17, 2024

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

from checkout-sdk-php.

adamjimenez avatar adamjimenez commented on July 17, 2024

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?

from checkout-sdk-php.

adamjimenez avatar adamjimenez commented on July 17, 2024

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

from checkout-sdk-php.

armando-rodriguez-cko avatar armando-rodriguez-cko commented on July 17, 2024

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.

from checkout-sdk-php.

armando-rodriguez-cko avatar armando-rodriguez-cko commented on July 17, 2024

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
                )

        )

)

from checkout-sdk-php.

adamjimenez avatar adamjimenez commented on July 17, 2024

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?

from checkout-sdk-php.

armando-rodriguez-cko avatar armando-rodriguez-cko commented on July 17, 2024

Hi @adamjimenez!

Debugging you can find a detailed error in:

image

image

from checkout-sdk-php.

adamjimenez avatar adamjimenez commented on July 17, 2024

from checkout-sdk-php.

armando-rodriguez-cko avatar armando-rodriguez-cko commented on July 17, 2024

I think that this link can help you:
https://www.checkout.com/docs/card-issuing/manage-cards/enroll-a-card-in-3d-secure

from checkout-sdk-php.

adamjimenez avatar adamjimenez commented on July 17, 2024

from checkout-sdk-php.

adamjimenez avatar adamjimenez commented on July 17, 2024

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

from checkout-sdk-php.

armando-rodriguez-cko avatar armando-rodriguez-cko commented on July 17, 2024

Hi @adamjimenez, please check https://www.checkout.com/docs/card-issuing/manage-cards/enroll-a-card-in-3d-secure

from checkout-sdk-php.

inikoo avatar inikoo commented on July 17, 2024

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

from checkout-sdk-php.

lrotherfield-function avatar lrotherfield-function commented on July 17, 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.

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.