Skip to content

abmid/dpay-sdk-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

113 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DurianPay SDK for Go

GoDoc Test Status Go Report Card License: MIT

Table of Contents

Overview

🚧 The SDK is currently undergoing heavy development with frequent changes, because of this the current major version is zero (v0.x.x) 🚧

Durianpay is a payments platform and aggregator which helps business to connect with different payment service providers (PSPs) and gateways.

Durianpay provides SDKs in several programming languages but not Go. Because of this, this SDK was created.

For more information, visit the DurianPay API Official documentation.

Installation

Make sure you are using go version 1.18 or later

go get github.com/abmid/dpay-sdk-go

Documentation

package main

import (
	"context"

	durianpay "github.com/abmid/dpay-sdk-go"
	"github.com/abmid/dpay-sdk-go/client"
)

func main() {
	// Init client to access all difference resources
	c := client.NewClient(client.Options{
		ServerKey: "XXX-XXX",
	})

	//----------------------------------------------
	// Example Validate Disbursement
	//----------------------------------------------
	payload := durianpay.DisbursementValidatePayload{
		XIdempotencyKey: "c128fc41-46e7-42fd-93ef-cb147a8f96c8",
		AccountNumber:   "12345678",
		BankCode:        "bca",
	}

	res, err := c.Disbursement.Validate(context.Background(), payload)
	if err != nil {
		// Handle error
	}
}

Below is an example of implementing Idempotent Request (X-Idempotency-Key and idempotency_key) in this SDK, for the differences between X-Idempotency-Key and idempotency_key you can read in the Idempotent Request Implementation Guide

  payload := durianpay.DisbursementPayload{
    XIdempotencyKey: "c128fc41-46e7-42fd-93ef-cb147a8f96c8",
    IdempotencyKey:  "1",
    Name:            "Test Name",
    Description:     "Test Desc",
    Items: []durianpay.DisbursementItemPayload{
      {
        AccountOwnerName: "Goodman",
        BankCode:         "bca",
        Amount:           "10000",
        AccountNumber:    "222444",
        EmailRecipient:   "goodman@domain.com",
        PhoneNumber:      "081234567890",
        Notes:            "Salary",
      },
    },
  }

  // Without params
  res, err := c.Disbursement.Submit(context.TODO(), payload, nil)
  if err != nil {
    // Handle error
  }

For more examples, please check directory example and Godoc

API Supports

  • ORDERS
    • Create Order
    • Fetch Orders
    • Fetch By ID
    • Create Payment Link
  • PAYMENTS
    • Charge Payment
    • Fetch Payments
    • Fetch Payment By ID
    • Check Payment Status
    • Verify Payment
    • Cancel Payment
    • MDR Fees Calculation
  • PROMOS
    • Create Promo
    • Fetch Promos
    • Fetch Promo By ID
    • Delete Promo
    • Update Promo
  • DISBURSEMENTS
    • Submit Disbursement
    • Approve Disbursment
    • Validate Disbursement (Tested)
    • Fetch Bank List
    • Topup Amount
    • Fetch Topup Detail By ID
    • Fetch Balance
    • Fetch Disbursement Items By ID
    • Fetch Disbursement By ID
    • Delete Disbusement By ID
  • SETTLEMENTS
    • Fetch Settlements
    • Detail Settlement By ID
    • Status Settlement By ID
    • Fetch Settlement By ID
  • REFUNDS
    • Create Refund
    • Fetch Refunds
    • Fetch Refund By ID
  • E-WALLET Account
    • Link E-Wallet Account
    • Unlink E-Wallet Account
    • Detail E-Wallet Account
  • VIRTUAL ACCOUNTS
    • Create VA
    • Fetch VAs
    • Fetch VA By ID
    • Patch VA By ID
    • Simulate VA Payment
  • INVOINCES
    • Create Invoince
    • Generate Checkout URL
    • Fetch Invoice By ID
    • Fetch Invoices / List Invoices
    • Update Invoice
    • Pay Invoice
    • Manual Payment Invoice
    • Delete Invoice

Contributing

We are open and grateful for any contribution. If you want to contribute please do PR and follow the code guide.

License

Copyright (c) 2023-present Abdul Hamid and Contributors. This SDK is free and open-source software licensed under the MIT License.

About

Durianpay SDK for Go (Unofficial)

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages