Skip to content

danteay/oxxopay

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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))