PHP Classes

File: samples/credit.php

Recommend this page to a friend!
  Classes of Jonatas Matheus Gino de Souza  >  API Getnet PHP Client  >  samples/credit.php  >  Download  
File: samples/credit.php
Role: Example script
Content type: text/plain
Description: Example script
Class: API Getnet PHP Client
Access Getnet e-commerce Web services via its API
Author: By
Last change:
Date: 2 years ago
Size: 1,125 bytes
 

Contents

Class file image Download
<?php
require_once $_SERVER['DOCUMENT_ROOT'] . '/GETNET-API-Client/Credit.php';
$credit = new Credit();
$data = [
   
'amount' => '1000',
   
'name' => 'Payer Name',
   
'email' => 'payer@mail.com',
   
'document_type' => 'CPF', // CPF or CNPJ
   
'document_number' => '00000000000',
   
'phone_number' => '99999999999',
   
'street' => 'Street name',
   
'number' => '22',
   
'complement' => 'complement',
   
'district' => 'district name',
   
'city' => 'city name',
   
'state' => 'state name',
   
'country' => 'Brazil',
   
'postal_code' => 'postal_code',
   
'cardholder_name' => 'cardholder name',
   
'security_code' => 'security code',
   
'brand' => 'brand',
   
'expiration_date' => '12/23',
   
'card_number' => 'card number'
];


// credito call
$retData = $credit->doPayment($data);

$err = false;
$message = '';
if(!empty(
$retData['payment_id'])) {
   
$message = 'Your billing was successfully generated! <br> Your payment id is: <b>'
       
. $retData['payment_id']
        .
'</b>. <br> Hold it to check with the seller.';
}
else {
   
$error = true;
   
$message = 'Payment unauthorized. ';
}

echo
$message;

For more information send a message to info at phpclasses dot org.