Created
February 1, 2018 11:19
-
-
Save murilohns/50fa72f37e37c11acef4e4695df6e6e3 to your computer and use it in GitHub Desktop.
Pagar.me SoftDescriptor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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