GithubHelp home page GithubHelp logo

line-pay-csharp's Introduction

LINE Pay dotnet core C# SDK

※日本語のドキュメントはこちら

This is unofficial SDK for LINE Pay for C# developers.
You can find detail API document here

Getting Started

This repository contains sample web application to use the SDK. Update ChannelId, ChannelSecret and ServerUri.

Create sandbox

Go to LINE Pay Developers and create your sandbox. You can retrieve Channel Id and Channel Secret Key after successful login to LINE Pay Console. You also need to configure white lists of server ip addresses which access to LINE Pay API.

How to use the SDK

Instantiate client Pass channel information and if you use sandbox or not.

var channelId = "channel id";
var channelSecret = "channel secret";
var isSandbox = true;
var client = new LinePayClient(
                channelId,
                channelSecret,
                isSandbox);

Reserve the order Instantiate reserve object and pass to ReserveAsync

var reserve = new Reserve()
{
    ProductName = "Chocolate",
    Amount = 2.2,
    Currency = Currency.USD,
    OrderId =  Guid.NewGuid().ToString(), // Unique order id
    ConfirmUrl = $"{configuration["ServerUri"]}/api/pay/confirm", // Cancel Url
    CancelUrl = $"{configuration["ServerUri"]}/api/pay/cancel", // Confirm Url
}

var response = await client.ReserveAsync(reserve);

Confirm the order Instantiate confirm object by using reserve you created, and call ConfirmAsync.

var transactionId = Int64.Parse(HttpContext.Request.Query["transactionId"]);

var reserve = //get your reserve from db.

var confirm = new Confirm()
{
    Amount = reserve.Amount,
    Currency = reserve.Currency
}

var response = await client.ConfirmAsync(transactionId, confirm);

See the sample web app in the repository for more detail.

License

MIT

line-pay-csharp's People

Contributors

kenakamu avatar

Watchers

James Cloos 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.