cURL
curl --request POST \
--url https://api.malga.io/v1/tokens \
--header 'Content-Type: application/json' \
--header 'X-Api-Key: <api-key>' \
--header 'X-Client-Id: <api-key>' \
--data '
{
"cardHolderName": "JOSE DAS NEVES",
"cardNumber": "4019598346009339",
"cardCvv": "123",
"cardExpirationDate": "12/2026"
}
'const options = {
method: 'POST',
headers: {
'X-Client-Id': '<api-key>',
'X-Api-Key': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
cardHolderName: 'JOSE DAS NEVES',
cardNumber: '4019598346009339',
cardCvv: '123',
cardExpirationDate: '12/2026'
})
};
fetch('https://api.malga.io/v1/tokens', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.malga.io/v1/tokens"
payload := strings.NewReader("{\n \"cardHolderName\": \"JOSE DAS NEVES\",\n \"cardNumber\": \"4019598346009339\",\n \"cardCvv\": \"123\",\n \"cardExpirationDate\": \"12/2026\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Client-Id", "<api-key>")
req.Header.Add("X-Api-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"tokenId": "cc0b1e41-2936-45c5-947f-93995ffcdc00"
}{
"error": {
"code": 123,
"declinedCode": "<string>",
"key": "<string>",
"businessCode": "<string>",
"message": "<string>",
"details": "<array>"
}
}{
"error": {
"code": 123,
"declinedCode": "<string>",
"key": "<string>",
"businessCode": "<string>",
"message": "<string>",
"details": "<array>"
}
}Tokens
Criar um novo token
POST
/
v1
/
tokens
cURL
curl --request POST \
--url https://api.malga.io/v1/tokens \
--header 'Content-Type: application/json' \
--header 'X-Api-Key: <api-key>' \
--header 'X-Client-Id: <api-key>' \
--data '
{
"cardHolderName": "JOSE DAS NEVES",
"cardNumber": "4019598346009339",
"cardCvv": "123",
"cardExpirationDate": "12/2026"
}
'const options = {
method: 'POST',
headers: {
'X-Client-Id': '<api-key>',
'X-Api-Key': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
cardHolderName: 'JOSE DAS NEVES',
cardNumber: '4019598346009339',
cardCvv: '123',
cardExpirationDate: '12/2026'
})
};
fetch('https://api.malga.io/v1/tokens', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.malga.io/v1/tokens"
payload := strings.NewReader("{\n \"cardHolderName\": \"JOSE DAS NEVES\",\n \"cardNumber\": \"4019598346009339\",\n \"cardCvv\": \"123\",\n \"cardExpirationDate\": \"12/2026\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Client-Id", "<api-key>")
req.Header.Add("X-Api-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"tokenId": "cc0b1e41-2936-45c5-947f-93995ffcdc00"
}{
"error": {
"code": 123,
"declinedCode": "<string>",
"key": "<string>",
"businessCode": "<string>",
"message": "<string>",
"details": "<array>"
}
}{
"error": {
"code": 123,
"declinedCode": "<string>",
"key": "<string>",
"businessCode": "<string>",
"message": "<string>",
"details": "<array>"
}
}Body
application/json
Tokenizar
Pode ser tokenizado o cartão e/ou cvv de acordo com a passagem dos atributos
- Option 1
- Option 2
Show child attributes
Show child attributes
Response
Created
Identificador do token gerado
Related topics
Criar um novo setupCriar novo cartão a partir de tokenIntegraçãoPagamentos com Pix na MalgaWas this page helpful?
⌘I