Giter Site home page Giter Site logo

bunqapi's Introduction

Sycade.BunqApi

A .NET bunq API client by Sycade.

Requirements

To use the .NET bunq API client, you need:

  • an API key (created in the Bunq Android (Sandbox) or iOS app;
  • a PKCS #12 (.pfx) file with exportable private key (can be self-signed) for API request signing.

Example

Create a new Installation and execute a payment

var clientCertificate = new X509Certificate2("your-certificate.pfx", "your-pvk-password");
var useSandbox = true;

var bunq = new BunqApiClient("your-api-key", clientCertificate, useSandbox);

// Link your API key to this IP address
var installation = await new InstallationEndpoint(bunq).CreateAsync();
bunq.SetServerPublicKey(installation.ServerPublicKey);

var deviceServer = await new DeviceServerEndpoint(bunq).CreateAsync("My First DeviceServer", installation.Token);
var sessionServer = await new SessionServerEndpoint(bunq).CreateAsync(installation.Token);

// Get all monetary accounts for the User
var accounts = await new MonetaryAccountEndpoint(bunq).ListAsync(sessionServer.User, sessionServer.Token);

// Pay 25 euros from the first to the second bank account in the user account
var paymentId = await new PaymentEndpoint(bunq).CreateAsync(sessionServer.User, accounts[0].Id,
    accounts[1].Aliases[0], new Amount(Currency.EUR, 25m), "My First Payment", sessionServer.Token);

Reuse an existing installation

var clientCertificate = new X509Certificate2("your-certificate.pfx", "your-pvk-password");

var serverPublicKey = new ServerPublicKey(File.ReadAllText("the-server-public-key.crt"));
var installationToken = new Token(File.ReadAllText("the-installation-token.txt"));

var useSandbox = true;

var bunq = new BunqApiClient("your-api-key", clientCertificate, useSandbox);
bunq.SetServerPublicKey(serverPublicKey);

var sessionServer = await new SessionServerEndpoint(bunq).CreateAsync(installationToken);
// ... use your active session

bunqapi's People

Contributors

mlowijs avatar

Watchers

James Cloos avatar Michael Lakerveld 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.