$BC = new BarionClient($myPosKey, 2, BarionEnvironment::Test); // create the item model $item = new ItemModel(); $item->Name = "TestItem"; // no more than 250 characters $item->Description = "A test item for payment"; // no more than 500 characters $item->Quantity = 1; $item->Unit = "piece"; // no more than 50 characters $item->UnitPrice = 1000; $item->ItemTotal = 1000; $item->SKU = "ITEM-01"; // no more than 100 characters // create the transaction $trans = new PaymentTransactionModel(); $trans->POSTransactionId = "TRANS-01"; $trans->Payee = $myEmailAddress; // no more than 256 characters $trans->Total = 1000; $trans->Comment = "Test Transaction"; // no more than 640 characters $trans->AddItem($item); // add the item to the transaction // create the request model $psr = new PreparePaymentRequestModel(); $psr->GuestCheckout = true; // we allow guest checkout $psr->PaymentType = PaymentType::Immediate; // we want an immediate payment $psr->FundingSources = array(FundingSourceType::All);
// no more than 100 characters $ptrans1->Payee = "*****@*****.**"; // no more than 256 characters $ptrans1->Total = 1000; $ptrans1->Comment = "Royalties"; // no more than 640 characters $ptrans2 = new PayeeTransactionModel(); $ptrans2->POSTransactionId = "PTRANS-02"; // no more than 100 characters $ptrans2->Payee = "*****@*****.**"; // no more than 256 characters $ptrans2->Total = 3000; $ptrans2->Comment = "Royalties"; // no more than 640 characters // create the transaction $trans = new PaymentTransactionModel(); $trans->POSTransactionId = "TRANS-03"; $trans->Payee = $myEmailAddress; // no more than 256 characters $trans->Total = 50000; $trans->Comment = "Test Transaction"; // no more than 640 characters $trans->AddItem($item); // add the item to the transaction $trans->AddPayeeTransaction($ptrans1); // add the payee transactions to the transaction $trans->AddPayeeTransaction($ptrans2); // create the request model $psr = new PreparePaymentRequestModel(); $psr->GuestCheckout = true; // we allow guest checkout
$item1->SKU = "ITEM-01"; // no more than 100 characters $item2 = new ItemModel(); $item2->Name = "AnotherTestItem"; // no more than 250 characters $item2->Description = "Another test item for payment"; // no more than 500 characters $item2->Quantity = 2; $item2->Unit = "piece"; // no more than 50 characters $item2->UnitPrice = 250; $item2->ItemTotal = 250; $item2->SKU = "ITEM-02"; // no more than 100 characters // create the transaction model $trans = new PaymentTransactionModel(); $trans->TransactionId = "33333333-3333-3333-3333-333333333333"; // <-- Replace this with the original transaction ID! $trans->Total = 1500; $trans->Comment = "Reservation complete"; // no more than 640 characters $trans->AddItem($item1); // add the items to the transaction $trans->AddItem($item2); // create the request object $frrm = new FinishReservationRequestModel($paymentId); $frrm->AddTransaction($trans); // add the transaction to the request // send the request $finishReservationResult = $BC->FinishReservation($frrm); if ($finishReservationResult->RequestSuccessful) {