mollie / mollie-api-php

Mollie API client for PHP
http://www.mollie.com
BSD 2-Clause "Simplified" License
552 stars 191 forks source link

Please help getting started #222

Closed focussing closed 6 years ago

focussing commented 6 years ago

I tried to install the api via Composer or via ZIP download, but none of the described ways I get the \Mollie\api folder...

What am I doing wrong?

holtkamp commented 6 years ago

composer typically installs it in a vendor folder. By using autoloading you can then use it in your userland code

focussing commented 6 years ago

Hello @holtkamp , thank you for your reaction. Sorry but I do not have any idea how to do that... I struggled already for a few hours before I got the Composer thing working.

Couldn't you simply provide a zip file containing the api? We choose Mollie because of it's many interfacing possibilities but we are getting nowhere...

Many many thanks!!

Smitsel commented 6 years ago

Hi @focussing,

Sorry for the delay! We already have these zips available for you. The latest one is: https://github.com/mollie/mollie-api-php/releases/download/v2.0.6/mollie-api-php.zip

When u download and extract this and place it in your development folder, make sure to require the vendor/autoload.php file like this: require_once __DIR__ . "/vendor/autoload.php";

This way all the classes will be loaded and you can start using the client. Make sure to check out the examples. They will get you started.

Hope this helps!

holtkamp commented 6 years ago

Hi @focussing

I struggled already for a few hours before I got the Composer thing working.

Composer is the "accepted standard" for dealing with dependencies in PHP projects. While a single .ZIP archive of the Mollie library might be easy to get things going, on the long run I would really advise to use Composer for this. It will make it really easy to upgrade to new versions, etc.

Good luck!

Smitsel commented 6 years ago

Hope you got it running @focussing.

If you still run in to trouble, please check out our support articles: https://help.mollie.com/hc/nl/categories/201332145-Integratie

Or contact our support department.

focussing commented 6 years ago

Thank you, I was out for a while. It works, I can call the api/examples by typing them directly in the browser address bar. Is there an example of adressing the api for let's say example nr 04 from javascript?

Smitsel commented 6 years ago

Hi! Great that it worked with the feedback. Can you please forward this and future questions to: techsupport@mollie.com?

focussing commented 6 years ago

I will, thank you. English or Dutch? :)

Smitsel commented 6 years ago

They can help you in both ;)

focussing commented 6 years ago

I hope so; sent them a question at 13:36, hopefully they answer soon :)

I am able to create payments from my javascript application, and list all of them. Changed example 05 for that; basically adding

    $payments = $mollie->payments->page();
    echo json_encode($payments, JSON_FORCE_OBJECT);

However I cannot get example 04 to work properly; when I call the PHP script from my application (filling in amount parameters etc), according the guides; "Test payments come with a hosted payment page that allows you to select whether your test payments are successful or not without spending actual money.".

In the example 04 script there is a line $payment->getCheckoutUrl() https://www.mollie.com/paymentscreen/issuer/select/ideal/bjDqfNz7dk which is called after creating the payment. But that gives a CORS error:

Failed to load https://www.mollie.com/paymentscreen/issuer/select/ideal/Fu2fzGMRfg: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://www.monsteragenda.nl' is therefore not allowed access.

If you need I can send you the url not openly ;)

focussing commented 6 years ago

@Smitsel found it... so easy finally; I had to call the checkoutUrl mysel in my application....