GithubHelp home page GithubHelp logo

bpay's Introduction

BPAY Generator

Golang implementation of a BPAY Generator written in PHP

Features generators for MOD10v1 and MOD10v5 as well as a ValidateLuhn function to ensure a valid Mod10 check digit/Luhn checksum.

Background

BPAY has become a really easy way to receive payments in Australia so this helps generate the BPAY values in a compliant form.

  1. Register as the BPAY Biller at http://www.bpay.com.au/ -> you'll get your BPAY Biller code then; When your customer is willing to make a BPAY transfer - your application should generate a Customer Reference Number (CRN) programmatically (see below), or you can even generate valid CRNs manually using CRN Generator Tool (win/mac desktop app) - anyway, each CRN generated for a User can be used by him further on, although some applications/services do prefer to generate a new CRN for each new Order a User makes - both approaches are quite fine

  2. You should provide this pair of values to such a Customer:

    • Your BPAY Biller code;
    • The CRN generated/assigned to him;
  3. They then make a BPAY payment using these credentials

  4. You accept it on your end, then you just need to check the CRN value mentioned inside the payment details -> identify your Customer -> process the corresponding Order.

Customer Reference Number (CRN) generation

CRN is an identifier of a Customer within the BPAY Biller's customer base. This is a number of certain length (that is set up in advance by Biller when registered) that consists of the following two parts:

  1. CRN "seed" - certain numeric value that you choose, representing your Customer or an Order document inside your database. It can be your Customer or Order ID, but we recommend to avoid exposing your internal autoincremented IDs, instead - some randomized public IDs (of certain length, e.g. 12 digits) would better be used.
  2. A Check digit has to be calculated and appended to the value above. For BPAY CRNs specifically this Check digit gets calculated based on the value above - using the Luhn algorithm, mod 10 version 5 (MOD10V05):

Getting Started

go get -u github.com/17twenty/bpay

Then simply use it as:

import (
    "github.com/17twenty/bpay"
    ...
)

...
validBPAY := bpay.GenerateMOD10V1("yourInputAccount")
validBPAYv5 := bpay.GenerateMOD10V5("yourInputAccount")

Feature requests/PRs welcome.

See Also

Originally based on a StackOverflow answer

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.