Skip to main content
POST
/
v1
/
charges
/
3ds
/
setup
Python
import requests

client_id = <YOUR CLIENT ID>
public_key = <YOUR CLIENT TOKEN>

request = requests.post('https://api.malga.io/v1/charges/3ds/setup', headers={
    "X-Client-Id": client_id,
    "X-Api-Key": publick_key
  }, json={
  "sourceType": "card",
  "cardId": "4918cfd2-b14a-4db2-ade4-d1b8a6bd40e2",
})
print(request.json().get('id'))
curl --request POST \
  --url https://api.malga.io/v1/charges/3ds/setup \
  --header 'Content-Type: application/json' \
  --header 'X-Api-Key: <api-key>' \
  --header 'X-Client-Id: <api-key>' \
  --data '
{
  "sourceType": "card",
  "cardId": "cc0b1e41-2936-45c5-947f-93995ffcdc00"
}
'
const options = {
  method: 'POST',
  headers: {
    'X-Client-Id': '<api-key>',
    'X-Api-Key': '<api-key>',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({sourceType: 'card', cardId: 'cc0b1e41-2936-45c5-947f-93995ffcdc00'})
};

fetch('https://api.malga.io/v1/charges/3ds/setup', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://api.malga.io/v1/charges/3ds/setup",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => json_encode([
    'sourceType' => 'card',
    'cardId' => 'cc0b1e41-2936-45c5-947f-93995ffcdc00'
  ]),
  CURLOPT_HTTPHEADER => [
    "Content-Type: application/json",
    "X-Api-Key: <api-key>",
    "X-Client-Id: <api-key>"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.malga.io/v1/charges/3ds/setup"

	payload := strings.NewReader("{\n  \"sourceType\": \"card\",\n  \"cardId\": \"cc0b1e41-2936-45c5-947f-93995ffcdc00\"\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))

}
HttpResponse<String> response = Unirest.post("https://api.malga.io/v1/charges/3ds/setup")
  .header("X-Client-Id", "<api-key>")
  .header("X-Api-Key", "<api-key>")
  .header("Content-Type", "application/json")
  .body("{\n  \"sourceType\": \"card\",\n  \"cardId\": \"cc0b1e41-2936-45c5-947f-93995ffcdc00\"\n}")
  .asString();
require 'uri'
require 'net/http'

url = URI("https://api.malga.io/v1/charges/3ds/setup")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["X-Client-Id"] = '<api-key>'
request["X-Api-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"sourceType\": \"card\",\n  \"cardId\": \"cc0b1e41-2936-45c5-947f-93995ffcdc00\"\n}"

response = http.request(request)
puts response.read_body
{
  "id": "1b04367a-2386-4161-8c90-eac82267ee89",
  "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiI0MzljZGU0NC05M2RkLTQ2ZWEtYWU0OC0zNTMwMzg3NGFjMmQiLCJpYXQiOjE3Mjc3MTU5NDksImlzcyI6IjVkZDgzYmYwMGU0MjNkMTQ5OGRjYmFjYSIsImV4cCI6MTcyNzcxOTU0OSwiT3JnVW5pdElkIjoiNjU0NDUzNzkzZDJmNTM1NWE3YjljN2IxIiwiUmVmZXJlbmNlSWQiOiJhNjNhZTI0NS0zNzJkLTQ1ODktODVlYS1iMDBmM2VmNjA0NGYifQ.o4IKYrNnFbr3xn-qSm_9qL-Sn-WvCpKOUMxZna7SiYE",
  "collectUrl": "https://centinelapistag.cardinalcommerce.com/V1/Cruise/Collect",
  "providerType": "CYBERSOURCE"
}
{
  "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>"
  }
}

Authorizations

X-Client-Id
string
header
required
X-Api-Key
string
header
required

Body

application/json

Criar sessão no 3DS2 Malga

Dados para cobrança por cartão de crédito salve

sourceType
enum<string>
required

Tipo da origem da cobrança

Available options:
card
cardId
string<uuid>
required

Identificador do cartão quando source tipo card

Response

Created

id
string<uuid>

Identificador do setup

token
string

Token gerado no provedor 3DS, será utilizado na coleta de dados

collectUrl
string<url>

URL do provedor 3DS, será utilizado na coleta de dados

providerType
string

Informa qual provedor 3DS2 está sendo utilizado

error
object