Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions PHP/create_order.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?php
<?php

// The POST URL and parameters
$request = 'http://demo.vivapayments.com/api/orders'; // demo environment URL
//$request = 'https://www.vivapayments.com/api/orders'; // production environment URL

// Your merchant ID and API Key can be found in the 'Security' settings on your profile.
$MerchantId = 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx';
$APIKey = 'xxxxxxxxxxxxx';
$APIKey = 'xxxxxxxxxxxxx';

//Set the Payment Amount
$Amount = 100; // Amount in cents
Expand Down Expand Up @@ -44,15 +44,15 @@
echo $e->getMessage();
}

if ($resultObj->ErrorCode==0){ //success when ErrorCode = 0
if (isset($resultObj->ErrorCode) && $resultObj->ErrorCode==0){ //success when ErrorCode = 0
$orderId = $resultObj->OrderCode;
echo 'Your Order Code is: <b>'. $orderId.'</b>';
echo '<br/><br/>';
echo 'To simulate a successfull payment, use the credit card 4111 1111 1111 1111, with a valid expiration date and 111 as CVV2.';
echo '</br/><a href="http://demo.vivapayments.com/web/newtransaction.aspx?ref='.$orderId.'" >Make Payment</a>';
}
else{
} elseif (!isset($resultObj->ErrorCode)){
$output = 'The following error occured: ' . $resultObj->Message;
} else{
echo 'The following error occured: ' . $resultObj->ErrorText;
}

Expand Down