How to create payments using REST module for Mollie?

1
Hi guys, I am busy with integrating Mollie into the MxApp for payments and I want to create a payment using REST module, because I have no experience with REST i need your help with this first step... How to create payment using REST? See doc Mollie @ https://www.mollie.com/nl/docs/payments thnx
asked
9 answers
2

My response was a bit too big for a comment, so regarding your post action:

For the header, in your microflow where the post java action is called, before you do that make sure to use addHeaderToNextRequest. Values to use in the action are: Header = Authorization, Value = Bearer test_dHar4XY7LxsDOtmnkVtjNVWXLSlXsM.

For the Parameters, create a non-persistent entity which has the attributes amount, description, etc. In your microflow create the object and fill in the values for each of the attributes. Then, make sure to change the post Java Action settings. requestData should be your created object. submitAsFormData should be set to true.

Here's an example of how I did something similar for the Twitter REST API: https://modelshare.mendix.com/models/e66ac820-39b3-4dc6-8d07-9e03d2818b27/twitter-rest-api-post-example

answered
0

Try following this tutorial to get a grip on REST services in Mendix

Edit: If you want to add parameters to a POST request I think you need to write some custom Java code. AFAIK it isn't possible to do this using the Restservices module. This post on StackOverflow might point you in the right direction.

answered
0

Hi Willem, thanks. I actually tried with that one and the how-to, but it was not clear for me. When I am looking at the site of Mollie I see that i have to set up a POST like this (cURL):

Request code cURL

$ curl -X POST https://api.mollie.nl/v1/payments \
    -H "Authorization: Bearer test_dHar4XY7LxsDOtmnkVtjNVWXLSlXsM" \
    -d "amount=10.00" \
    -d "description=My first payment" \
    -d "redirectUrl=https://webshop.example.org/order/12345/" \
    -d "metadata[order_id]=12345"

Response of Mollie would be:

HTTP/1.1 201 Created
Content-Type: application/json; charset=utf-8

{
    "id":              "tr_7UhSN1zuXS",
    "mode":            "test",
    "createdDatetime": "2014-06-05T08:29:39.0Z",
    "status":          "open",
    "expiryPeriod":    "PT15M",
    "amount":          10.00,
    "description":     "My first payment",
    "metadata": {
        "order_id": "12345"
    },
    "locale": "nl",
    "profileId": "pfl_QkEhN94Ba",
    "links": {
        "paymentUrl":  "https://www.mollie.com/payscreen/select-method/7UhSN1zuXS",
        "redirectUrl": "https://webshop.example.org/order/12345/"
    }
}

1 - For step 1 creating the request code I need to consume REST service by using a POST request, I was wondering how to setup the parameters of this POST request?

answered
0

You can add custom header parameters with the existing java action addHeaderToNextRequest and create an object with the attributes named in the documentation of Mollie

If you have created your Mollie module the community will appreciate sharing it on Github/Mendix appstore :) we can improve the module after the first version of course!

answered
0

Willem en Pim thnx, I would like to develop together the Mollie module seen I have not a lot of experience.

@Pim, I developed the domain module for the Mollie module based on the JSON response on the site of Mollie.

I was not able to succeedhow should I setup the AddHeader java action for this": Authorization: Bearer test_dHar4XY7LxsDOtmnkVtjNVWXLSlXsM" \ ?

At the end I'd like to share it on GitHub, all help is welcome!

answered
0

Use the parameters in the java action Key: Authorization and Value: Bearer test_dHar4XY7LxsDOtmnkVtjNVWXLSlXsM

answered
0

Guys, based on the feedback I have done this, i see that the returnURL is not well executed...I think i make somewhere a mistake, could some feedback it?

CreatePayment MF

Microflow here

<iframe width="100%" height="491px" frameborder="0" src="https://modelshare.mendix.com/models/8a160d2d-fe48-457b-a65b-b693ab388890/ivk_createpayment?embed=true" allowfullscreen=""></iframe>
answered
0

Guys,

The POST rest service is going well I think, because I dont get errors, but the returnURL is not executed by Mollie. How can I control this? What should I do now?

Here is the microflow to make an payment an create a post service Microflow

answered
0

Guys,

The POST rest service is going well I think, because I dont get errors, but the returnURL is not executed by Mollie. How can I control this? What should I do now?

Here is the microflow to make an payment an create a post service

answered