Skip to content

Latest commit

 

History

History
76 lines (57 loc) · 1.15 KB

README.md

File metadata and controls

76 lines (57 loc) · 1.15 KB

OxxoPay Go

Installing

go get https://github.com/danteay/oxxopay

Importing

import op "github.com/danteay/oxxopay"

Usage

Configuring

privateApiKey := "key_asdRfdasASfadf"

client := new(op.OpClient)
client.Init(privateApiKey)

CreateOrder

data := op.RequestData{
  "line_items": []op.RequestData{
    op.RequestData{
      "name":       "La divina comedia",
      "unit_price": 12345,
      "quantity":   1,
    },
  },
  "currency": "MXN",
  "customer_info": op.RequestData{
    "name":  "Dante Aligeri",
    "email": "dante@inferno.com",
    "phone": "+525561463627",
    "charges": []op.RequestData{
      op.RequestData{
        "payment_method": op.RequestData{
          "type": "oxxo_cash",
        },
      },
    },
  },
}

response, errReq := client.CreateOrder(data)

fmt.Println(err)
fmt.Println(string(response))

Get Order Info

orderId := "ord_bjhbkjntgfouvasd"

response, errReq := client.GetOrder(orderId)

fmt.Println(err)
fmt.Println(string(response))

Get List Orders

response, errReq := client.GetListOrders(orderId)

fmt.Println(err)
fmt.Println(string(response))