Skip to content

Instantly share code, notes, and snippets.

@murilohns
Created February 1, 2018 11:19
Show Gist options
  • Save murilohns/50fa72f37e37c11acef4e4695df6e6e3 to your computer and use it in GitHub Desktop.
Save murilohns/50fa72f37e37c11acef4e4695df6e6e3 to your computer and use it in GitHub Desktop.
Pagar.me SoftDescriptor
<?php
require 'vendor/autoload.php';
$pagarMe = new \PagarMe\Sdk\PagarMe('SUA_API_KEY');
$amount = 1000;
$installments = 1;
$capture = true;
$postbackUrl = 'http://requestb.in/pkt7pgpk';
$metadata = ['idProduto' => 13933139];
$extraAttributes = [
'card_cvv' => '616',
'async' => false,
'soft_descriptor' => 'My Soft D'
];
//TRANSAÇÃO DE CARTÃO DE CRÉDITO
$customer = new \PagarMe\Sdk\Customer\Customer(
[
'name' => 'John Dove',
'email' => '[email protected]',
'document_number' => '09130141095',
'address' => [
'street' => 'rua teste',
'street_number' => 42,
'neighborhood' => 'centro',
'zipcode' => '01227200',
'complementary' => 'Apto 42',
'city' => 'São Paulo',
'state' => 'SP',
'country' => 'Brasil'
],
'phone' => [
'ddd' => "15",
'number' =>"987523421"
],
'born_at' => '15021994',
'sex' => 'M'
]
);
$card = $pagarMe->card()->create(
'4242424242424242',
'Jon Snow',
'1220'
);
$transaction = $pagarMe->transaction()->creditCardTransaction(
$amount,
$card,
$customer,
$installments,
$capture,
$postbackUrl,
$metadata,
$extraAttributes
);
echo $transaction->getStatus();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment