-
Notifications
You must be signed in to change notification settings - Fork 0
/
example.paymentConfirm.php
executable file
·37 lines (25 loc) · 1.28 KB
/
example.paymentConfirm.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?php
require __DIR__ . '/vendor/autoload.php';
require_once "ratepay_credentials.php";
require_once "helper.createTransaction.php"; // Opens new transaction to handle
/********************************************************
* The PaymentConfirm confirms a authorized transaction *
********************************************************/
// PaymentConfirm needs 'head' only
$mbHead = new RatePAY\ModelBuilder();
$mbHead->setArray([
'SystemId' => "Example",
'Credential' => [
'ProfileId' => PROFILE_ID,
'Securitycode' => SECURITYCODE
],
'TransactionId' => $transactionId
]);
$rb = new RatePAY\RequestBuilder(true); // Sandbox mode = true
$paymentConfirm = $rb->callPaymentConfirm($mbHead);
if (!$paymentConfirm->isSuccessful()) die("PaymentConfirm not successful");
var_dump("PaymentConfirm successful");
// PaymentConfirm response object provides no specific methods
/*********************************************************************************************************************************
* The library throws decidedly exceptions. It's recommended to surround model building and request calls with try-catch-blocks. *
*********************************************************************************************************************************/