Problem with BlueSnap Integration(Card Transaction API)

277 Views Asked by At

I am trying to implement BlueSnap payment(Embedded Checkout) on my WebApp in Laravel 6.

https://developers.bluesnap.com/v8976-Tools/docs/embedded-checkout.

I allowed server and public IP to access the BlueSnap Sandbox routes

First, I am getting the token from BlueSnap and this work perfect. https://developers.bluesnap.com/v8976-Tools/docs/create-embedded-checkout-token.

But then, when I request for card transaction (https://developers.bluesnap.com/v8976-JSON/docs/auth-capture), with "pfToken" which I get from previous request, I am getting 401.

public function makePayment(Request $request) {

    $endpoint = 'https://sandbox.bluesnap.com/services/2/transactions';

    try {

        $client = new \GuzzleHttp\Client();

        $response = $client->request('POST', $endpoint, [
            'headers' => [
                'Content-Type' => 'application/json',
                'Accept' => 'application/json',
                'Authorization' => 'Basic dXNlcm5hbWU6cGFzc3dvcmQ='
            ],
            'json' => [
                'cardTransactionType' => 'AUTH_CAPTURE',
                'amount' => '25.00',
                'currency' => 'USD',
                'pfToken' => $request->token,
            ],

        ]);

    } catch (RequestException $e) {

        dd($e);

    }


    dd($response);

}

I also tried to send request with Postman, and I got same error.

0

There are 0 best solutions below