Skip to content

Bcash SDK Checkout Web

License

GPL-2.0, Apache-2.0 licenses found

Licenses found

GPL-2.0
LICENSE
Apache-2.0
LICENSE.md
Notifications You must be signed in to change notification settings

maracaipe/bcash-checkout-php-sdk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bcash Checkout Web

Total Downloads GitHub tag

require_once 'autoloader.php';

use Bcash\Domain\PaymentRequest;
use Bcash\Domain\Buyer;
use Bcash\Helper\FormHelper;

$sellerMail = '[email protected]';

$buyerMail = '[email protected]';
$buyerName = 'Comprador de Teste';
$buyerCpf = '983.007.561-32';
$buyerPhoneNumber = '11 3111-1111';

$urlReturn = 'https://www.bcash.com.br/lojamodelo/atualiza_status.php';
$redirectTime = 30;
$redirect = true;
$orderId = 123;

$products = array(
	(object) array(
		'code' 		=> 123456,
		'description' 	=> 'Product1',
		'amount'	=> 2,
		'value'		=> 123.10,
		'weight'	=> 100,
		'extra'		=> 'Test'
	)
);

$request = new PaymentRequest($sellerMail);
$request->setRedirect($urlReturn, $redirectTime, $redirect  );
$request->setOrderId($orderId);


foreach($products as $product){
	$request->addProduct(
			$product->code,
			$product->description,
			$product->amount,
			$product->value,
			$product->weight,
			$product->extra
	);
}

$buyer = new Buyer();
$buyer->setEmail($buyerMail);
$buyer->setName($buyerName);
$buyer->setCpf($buyerCpf);
$buyer->setPhoneNumber($buyerPhoneNumber);
$request->setBuyer($buyer);

echo FormHelper::generateForm($request->toPostArray());

About

Bcash SDK Checkout Web

Resources

License

GPL-2.0, Apache-2.0 licenses found

Licenses found

GPL-2.0
LICENSE
Apache-2.0
LICENSE.md

Stars

Watchers

Forks

Packages

No packages published

Languages