Giter Club home page Giter Club logo

scala-mollie-payments's Introduction

scala-mollie-payments

Create mollie payments in scala

Make sure to check out:

Add to your project

Currently scala-mollie-payments is available Sonatype Snapshots:

resolvers += "Sonatype OSS Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots"
libraryDependencies += "com.github.amazingdreams" %% "scala-mollie-payments" % "0.1.0-SNAPSHOT"

Connecting to mollie

You can find your api keys on the mollie dashboard. Also make sure you are not mixing up testMode and the api key!

import com.github.amazingdreams.mollie.MollieClient

val mollieClient = new MollieClient(
  apiKey = "YOUR_API_KEY",
  testMode = true
)

Creating a bare payment

This will redirect the user to mollie's pages, where they can select the payment method and enter details.

import com.github.amazingdreams.mollie.requests.CreatePaymentRequest

mollieClient.request(CreatePaymentRequest(
  amount = 10d,
  description = "test",
  redirectUrl = "http://example.com/redirect",
  webhookUrl = "http://example.com/webhook"
)).map { createPaymentResult => {
  createPaymentResult.fold(
    errors => println(errors),
    payment => println(payment)
  )
})

Creating a customer

This creates a new customer. The customer can be used to e.g. automatically create payments and have them be paid immediately. Please refer to the documentation: https://www.mollie.com/en/docs/recurring

com.github.amazingdreams.mollie.requests.CreateCustomerRequest

mollieClient.request(CreateCustomerRequest(
  name = Some("MR. Test"),
  email = Some("[email protected]")
)).map { createCustomerResult => {
  createCustomerResult.fold(
    errors => println(errors),
    customer => println(customer)
  )
})

scala-mollie-payments's People

Contributors

amazingdreams avatar

Watchers

 avatar  avatar

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.