Skip to content

Instantly share code, notes, and snippets.

@aaoliveira
Created September 14, 2016 20:24
Show Gist options
  • Save aaoliveira/0c744f614f464787694b228f4a189535 to your computer and use it in GitHub Desktop.
Save aaoliveira/0c744f614f464787694b228f4a189535 to your computer and use it in GitHub Desktop.
Checkout
<!DOCTYPE html>
<html lang="en">
<head>
<title></title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<!-- Iframe -->
<iframe src="https://carteirac1.hml.stelo.com.br/transaction/transfer?idUnico=cf8db6fe61bc1efebc6ae4f5ab4af60c" width="0" marginwidth="0" height="0" marginheight="0" frameborder="0">
</iframe>
<!-- /Iframe -->
<script src="https://code.jquery.com/jquery-1.12.4.min.js" integrity="sha256-ZosEbRLbNQzLpnKIkEdrPv7lOy9C27hHQ+Xp8a4MxAQ=" crossorigin="anonymous"></script>
<script src="https://carteirac1.hml.stelo.com.br/static/js/component/register-card.js"></script>
<script>
var data = {
'number': '4454575454454654', // dados falsos, pois estou postanto publicamente, mais em teste estou colocando os dados reals
'embossing': 'Alexandre Azevedo',
'expiryDate': '05/2024', // Tentei também como 05/24
'cvv': '095'
}
$.ajax({
type: "POST",
url: "token.php",
dataType: 'json',
async: false,
headers: {
"Authorization": "Basic Y2Y4ZGI2ZmU2MWJjMWVmZWJjNmFlNGY1YWI0YWY2MGM6ZjUzOGI3M2ExMWVhYzQ5ODI3ZjZkYTY3OGU4NTlmYTc="
},
data: data,
success: function(response) {
console.log(response);
},
error: function(response) {
console.log(response);
}
});
</script>
</body>
</html>
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://apic1.hml.stelo.com.br/security/v1/cards/tokens",
CURLOPT_POSTFIELDS => http_build_query($_POST),
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "utf-8",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => array(
"authorization: Basic Y2Y4ZGI2ZmU2MWJjMWVmZWJjNmFlNGY1YWI0YWY2MGM6ZjUzOGI3M2ExMWVhYzQ5ODI3ZjZkYTY3OGU4NTlmYTc=",
"cache-control: no-cache",
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment