Click here to Skip to main content
15,918,889 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
AnswerRe: Weird phone call Pin
Nish Nishant11-Nov-18 12:34
sitebuilderNish Nishant11-Nov-18 12:34 
GeneraliPhone 8 Hardware Audio Switch Pin
ZurdoDev9-Nov-18 7:31
professionalZurdoDev9-Nov-18 7:31 
GeneralRe: iPhone 8 Hardware Audio Switch Pin
dandy729-Nov-18 10:13
dandy729-Nov-18 10:13 
GeneralRe: iPhone 8 Hardware Audio Switch Pin
Maximilien10-Nov-18 1:29
Maximilien10-Nov-18 1:29 
GeneralRe: iPhone 8 Hardware Audio Switch Pin
ZurdoDev11-Nov-18 13:46
professionalZurdoDev11-Nov-18 13:46 
GeneralI'm impressed... Pin
Sander Rossel9-Nov-18 6:02
professionalSander Rossel9-Nov-18 6:02 
GeneralRe: I'm impressed... Pin
R. Giskard Reventlov9-Nov-18 6:24
R. Giskard Reventlov9-Nov-18 6:24 
GeneralRe: I'm impressed... Pin
Sander Rossel9-Nov-18 8:26
professionalSander Rossel9-Nov-18 8:26 
This is what I found, nothing serious, but it'll get you started.
Before you start, make sure you actually set at least one payment method in your profile or you'll get an exception from the web API "no payment methods found" (which is fairly descriptive, except when you're completely new).
Also, when you create a payment you get a response with some URL's, one of those is the URL that your users should visit to complete their payment, but you're responsible for redirecting the user (which makes sense, because their web API can't do it for you). The docs don't mention this very explicitly.
And you get updates on your payments through an optional webhook. I haven't tried it yet, but I do want to implement it, but the problem is that your localhost can't accept HTTP requests from Mollie, so you'll need to run this code on a server that can. I plan on creating a simple Azure Function that updates my dev database, so I can make a request on my localhost, get an update on Azure, but still see the change on localhost. The docs do mention this problem with webhooks.

Here's my very first try-out code for Mollie, almost worked on the first try. Without the webhook for updates.
C#
public async Task<IActionResult> Pay()
{
    using (var client = new HttpClient())
    {
        var id = Guid.NewGuid().ToString();
        var request = new
        {
            amount = new
            {
                currency = "EUR",
                value = "1.00"
            },
            description = "Test payment",
            redirectUrl = $"https://localhost:[port]/OrderCompleted?id={id}",
            metadata = new
            {
                id
            }
        };
        var json = JsonConvert.SerializeObject(request);
        var content = new StringContent(json, Encoding.UTF8, "application/json");
        client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", "test_[your code]");
        var response = await client.PostAsync("https://api.mollie.com/v2/payments", content);
        var responseContent = await response.Content.ReadAsStringAsync();
        if (response.IsSuccessStatusCode)
        {
            string url = JsonConvert.DeserializeObject<dynamic>(responseContent)._links.checkout.href;
            return Redirect(url);
        }
    }
    return Ok();
}
There's also an third party library, but for me it doesn't get much more difficult than this so I don't need it Smile | :)

GeneralRe: I'm impressed... Pin
R. Giskard Reventlov9-Nov-18 9:32
R. Giskard Reventlov9-Nov-18 9:32 
GeneralRe: I'm impressed... Pin
Ron Anders9-Nov-18 6:27
Ron Anders9-Nov-18 6:27 
GeneralRe: I'm impressed... Pin
RickZeeland9-Nov-18 7:10
mveRickZeeland9-Nov-18 7:10 
GeneralRe: I'm impressed... Pin
kmoorevs9-Nov-18 7:13
kmoorevs9-Nov-18 7:13 
JokeRe: I'm impressed... Pin
ZurdoDev9-Nov-18 7:35
professionalZurdoDev9-Nov-18 7:35 
GeneralRe: I'm impressed... Pin
Sander Rossel9-Nov-18 8:28
professionalSander Rossel9-Nov-18 8:28 
GeneralRe: I'm impressed... Pin
  Forogar  9-Nov-18 8:18
professional  Forogar  9-Nov-18 8:18 
GeneralRe: I'm impressed... Pin
Sander Rossel9-Nov-18 8:29
professionalSander Rossel9-Nov-18 8:29 
GeneralRe: I'm impressed... Pin
dandy729-Nov-18 10:08
dandy729-Nov-18 10:08 
GeneralRe: I'm impressed... Pin
Vincent Maverick Durano9-Nov-18 12:06
professionalVincent Maverick Durano9-Nov-18 12:06 
GeneralRe: I'm impressed... Pin
Sander Rossel10-Nov-18 1:17
professionalSander Rossel10-Nov-18 1:17 
GeneralPython Pin
#realJSOP9-Nov-18 5:43
professional#realJSOP9-Nov-18 5:43 
GeneralRe: Python Pin
Richard MacCutchan9-Nov-18 5:51
mveRichard MacCutchan9-Nov-18 5:51 
GeneralRe: Python Pin
#realJSOP9-Nov-18 6:35
professional#realJSOP9-Nov-18 6:35 
GeneralRe: Python Pin
Richard MacCutchan9-Nov-18 7:15
mveRichard MacCutchan9-Nov-18 7:15 
GeneralRe: Python Pin
Marc Clifton9-Nov-18 7:07
mvaMarc Clifton9-Nov-18 7:07 
GeneralRe: Python Pin
RickZeeland9-Nov-18 7:21
mveRickZeeland9-Nov-18 7:21 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.