GithubHelp home page GithubHelp logo

razorpay-go's Introduction

Razorpay Go Client

Golang bindings for interacting with the Razorpay API

This is primarily meant for merchants who wish to perform interactions with the Razorpay API programatically

Usage

You need to setup your key and secret using the following: You can find your API keys at https://dashboard.razorpay.com/#/app/keys.

import (
razorpay "github.com/razorpay/razorpay-go"
)

client := razorpay.NewClient("<YOUR_API_KEY>", "<YOUR_API_SECRET>")

Note: All methods below return a map[string]interface{} and error.

Payments

  • Fetch all payments
    body, err := client.Payment.All()
  • Fetch a particular payment
    body, err := client.Payment.Fetch(<payment_id>)
  • Capture a payment
    body, err := client.Payment.Capture(<payment_id>, <amount>)
    Note: amount is in paisa
  • Refund a payment
    body, err := client.Payment.Refund(<payment_id>, <amount_to_be_refunded>)

Refunds

  • Fetch all refunds
    body, err := client.Refund.All()
    
  • Fetch a particular refund
    body, err := client.Refund.Fetch(<refund_id>)
    

Orders

  • Create a new order

    data := map[string]interface{}{
        "amount":          1234,
        "currency":        "INR",
        "receipt_id":      "some_receipt_id",
        "payment_capture": 1,
    }
    body, err := client.Order.Create(data)

    Note: data is a map and should contain these keys

      amount           : amount of order(in paisa)
      currency         : currency of order
      receipt          : receipt id of order
      payment_capture  : 1 if capture should be done automatically or else 0
      notes(optional)  : optional notes for order
    
  • Fetch a particular order

    body, err := client.Order.Fetch(<order_id>)
  • Fetch all orders

    body, err := client.Order.All()
  • Fetch all payments for order

    body, err := client.Order.Payments(<order_id>)

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.