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

Problem with creating request #15

Open
Studiotekst opened this issue Jun 25, 2019 · 1 comment
Open

Problem with creating request #15

Studiotekst opened this issue Jun 25, 2019 · 1 comment

Comments

@Studiotekst
Copy link

Studiotekst commented Jun 25, 2019

Hello collegues,

I have a question.
It's the first time that i'm building a website that needs to make use of the Omnikassa 2.0 payment provider. I'm working in Laravel so after some research i found thephpleague/omnipay and the thephpleague/omnipay-rabobank repo's. Thanks for that! After some reading and trying i ran into some troubles. My first question: does someone have some example code for me? I can't figure out how my dataset needs to look like. My function for a payment request looks like this:
` $sOrderId = 'WEB' . time(); // This should be unique - Order id
$sTransactionReference = $sOrderId . date('His'); // This should be unique - Identifier of transaction
$amount = 10.00;

        $gateway = Omnipay::create('Rabobank');

        $request = $gateway->purchase(array(
            'testMode' => true,
            'RefreshToken' => '****REFRESH TOKEN SANDBOX*****',
            'SigningKey' => '****SIGNING KEY SANDBOX*****'',
            'amount' => $amount,
            'returnUrl' => '****RETURN URL*****',
            'automaticResponseUrl' => '****AUTOMATIC RESPONSE URL*****'',
            'currency' => 'EUR',
            'transactionReference' => $sTransactionReference,
            'orderId' => $sOrderId,
            'customerLanguage' => "NL",
            'description' => 'Lorem Ipsum is slechts',
            'PaymentMethod' => 'IDEAL'
            )
        );

        $data = $request->getData();
        $response = $request->sendData($data);
        dd($response);

        if ($response->isSuccessful()) {
            // payment was successful: update database
            print_r($response);
        } elseif ($response->isRedirect()) {
            // redirect to offsite payment gateway
            $response->redirect();
        } else {
            // payment failed: display message to customer
            echo $response->getMessage();
        }
`

(Of course i replaced the properties with ****** with the right values).
But when i approach this function, i'm getting error: Undefined index: token in function fetchAccessToken (/vendor/omnipay/rabobank/src/Message/Request/AbstractRabobankRequest.php). Can someone tell me how, and where i need to configure this token. I build some apps in past which uses Mollie as payment provider but never build apps with Omnikassa. So hopefully someone can help me out of this.
I have installed this packages with composer:
"league/omnipay": "^3",
"omnipay/rabobank": "^v3.0.0-beta1",

Thank you very much in advance,
Martijn

@joriskuijpers
Copy link

Hi Martijn,

Maybe this is a bit late 😄 but I also had difficulties testing this with the latest version. But it's very important whenever you test that you but in the testMode value upfront the payment like:

$gateway->initialize([
    'signingKey' => config('RABO_SINGINGKEY'),
    'refreshToken' => config('RABO_REFRESHTOKEN'),
    'testMode' => config('RABO_TESTMODE', false),
]);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants