GithubHelp home page GithubHelp logo

meetdave3 / node-klarna Goto Github PK

View Code? Open in Web Editor NEW

This project forked from crystallizeapi/node-klarna-deprecated

0.0 1.0 0.0 135 KB

Node Klarna SDK for easy Klarna integration

License: MIT License

JavaScript 100.00%

node-klarna's Introduction

node-klarna

Node Klarna SDK for easy Klarna integration in Node.JS. Generic Klarna Node integration with specific support for the Crystallize headless ecommerce service.

Install

yarn add @crystallize/node-klarna

Usage V2

https://developers.klarna.com/en/gb/kco-v2

const KlarnaV2 = require('@crystallize/node-klarna/v2');

// For production
const client = new KlarnaV2({
  testDrive: false,
  merchantId: 123456, // Obtain from Klarna merchant site
  sharedSecret: "abcdefgh", // Obtain from Klarna merchant site
  storeName: 'mystore.com' // Obtain from Klarna merchant site
});

// If you don't want to use your own merchant
const client = new KlarnaV2({
  testDrive: true,
  useTestMerchant: true
});

// Create order
const { success, order } = client.createOrder(klarnaCheckoutModel);

// Confirm order
const { success } = client.confirmOrder(order.id);

// Capture order
const { success } = client.captureOrder(order.id);

// Transform a Crystallize basket model (from @crystallize/react-basket) to a Klarna model
const klarnaCart = client.crystallizeBasketToKlarnaCart(crystallizeBasket.state);

// Trigger a new recurring order
const { success } = client.createRecurringOrder(options, { recurring_token });

// Get status on a recurring order
const { success } = client.getRecurringOrderStatus(order.id);

node-klarna's People

Contributors

hakonkrogh avatar papelipe avatar

Watchers

 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.