Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/danteay/mercadopago


https://github.com/danteay/mercadopago

cash mercadopago oxxo payment

Last synced: about 1 month ago
JSON representation

Awesome Lists containing this project

README

        

# MercadoPago GO

Basic library for mercadopago

## Install

```bash
go get https://github.com/danteay/mercadopago
```

## Usage

### Importing

```go
import mp "github.com/danteay/mercadopago"
```

### Configuring

#### ClientId and ClientSecret

```go
clientId := "12345678987"
clientSecret := "iugbkjSfFewASndfvñjn1234"

client := new(mp.MpClient)
client.Init(clientId, clientSecret)
```

#### AccessToken

```go
accessToken := "APP_PP_iugbkjSfFewASndfvñjn1234nlkefa__T_TT__adfhbrjnkfkl"

client := new(mp.MpClient)
client.Init(accessToken)
```

### Create order

```go
paymentData := mp.RequestData{
"payer": mp.RequestData{
"type": "customer",
"email": "[email protected]",
"first_name": "Dante Aligeri",
"last_name": "",
},
"transaction_amount": 20,
"description": "Service expres - Service regular",
"payment_method_id": "oxxo",
}

response, err := client.CreatePayment(paymentData)

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