Giter Site home page Giter Site logo

Comments (14)

lstables avatar lstables commented on September 2, 2024 2

Will do, although they aren't the fastest cats :)

Awesome package btw 👍

from revolut-php.

sverraest avatar sverraest commented on September 2, 2024

Hi, great that you're using this package.
The response itself is parsed automatically as an array.
So your variable $counterparty will be an array that has the following information:

https://revolutdev.github.io/business-api/#add-revolut-counterparty

I would wrap this code in a try / catch block though.

from revolut-php.

lstables avatar lstables commented on September 2, 2024

Apologies this is within a try /catch

try {
            $pay = new Revolut($this->api_key); 
            $counterparty = $pay->counterparties->create(
                array (
                'company_name' => user()->companies()->first()->name,
                'bank_country' => 'GB',
                'currency' => 'GBP',
                'account_no' => $request->account_no,
                'sort_code' => $request->sort_code,
                "email" => user()->email,
                "phone" => user()->tel,
                'profile_type' => 'business',
                'address' => 
                    array (
                    'street_line1' => user()->companies()->first()->address_line_1,
                    'street_line2' => user()->companies()->first()->address_line_2,
                    'region' => '',
                    'postcode' => user()->companies()->first()->postcode,
                    'city' => user()->companies()->first()->city,
                    'country' => 'GB',
                    ),
                )
            );
        } catch (Exception $e) {
            \Log::info($e);
            return response()->json(['message' => 'There was something wrong, please try again.', 404]);
        }

So $pay as the array in, but once this is sent to Revolut I want to get their response to I can save the successful creation details.

from revolut-php.

sverraest avatar sverraest commented on September 2, 2024

What do you get when you do print_r($counterparty); after this call?

from revolut-php.

lstables avatar lstables commented on September 2, 2024

Nothing it seems.... :(

from revolut-php.

lstables avatar lstables commented on September 2, 2024

Seems there's an error either my end or theirs:

POST https://b2b.revolut.com/api/1.0/counterparty` resulted in a `400 Bad Request` response: {"message":"Sort code is in invalid format","code":4002}

Even though sending within the array like so "sort_code" => "$request->sort_code",

from revolut-php.

sverraest avatar sverraest commented on September 2, 2024

The sort_code parameter should be a string like "223344".
Are you including any hyphens maybe? "22-33-44" should be posted as "223344"

from revolut-php.

lstables avatar lstables commented on September 2, 2024

Yeah just posting as "000000"

from revolut-php.

sverraest avatar sverraest commented on September 2, 2024

Can you get a full request body / headers which is giving you this error?
Please check that you omit any sensitive data such as API Keys.
Otherwise I suggest to contact Revolut for Business directly.

from revolut-php.

lstables avatar lstables commented on September 2, 2024

Yeah API keys everything looks good as I did when I tested it before, so I will contact them directly.

from revolut-php.

sverraest avatar sverraest commented on September 2, 2024

Ok, do update the issue here if you hear back, thanks!

from revolut-php.

sverraest avatar sverraest commented on September 2, 2024

Was Revolut able to solve your issue? Anything specific to the package?

from revolut-php.

lstables avatar lstables commented on September 2, 2024

Nope, to be honest they were lacking in these areas shall we say. Also it appears they don't do what we wanted it to do, so for now at least we are staying with Stripe.

from revolut-php.

lstables avatar lstables commented on September 2, 2024

PS, the package is fine, just Revolut not so...

from revolut-php.

Related Issues (17)

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.