コード例 #1
0
ファイル: payment_send.php プロジェクト: joseic/sdk-php
------------------------------------------------------------------------------------------------------------
<br />

<?php 
require_once '../lib/Nimble/base/NimbleAPI.php';
$payment = array('amount' => 1010, 'currency' => 'EUR', 'customerData' => 'idSample12345', 'paymentSuccessUrl' => 'https://my-commerce.com/payments/success', 'paymentErrorUrl' => 'https://my-commerce.com/payments/error');
$params = array('clientId' => '729DFCD7A2B4643A0DA3D4A7E537FC6E', 'clientSecret' => 'jg26cI3O1mB0$eR&fo6a2TWPmq&gyQoUOG6tClO%VE*N$SN9xX27@R4CTqi*$4EO', 'mode' => 'demo');
/* High Level call */
$NimbleApi = new NimbleAPI($params);
$p = new Payments();
$response = $p->SendPaymentClient($NimbleApi, $payment);
?>

<?php 
/* Low Level call */
$NimbleApi = new NimbleAPI($params);
$NimbleApi->setPostfields(json_encode($payment));
$NimbleApi->uri = ConfigSDK::NIMBLE_API_BASE_URL . 'payments';
$NimbleApi->method = 'POST';
$response2 = $NimbleApi->rest_api_call();
?>

<br /><pre>
Response: (var_dump($response))
<?php 
var_dump($response);
?>

<br /><pre>
Response2: (var_dump($response2))
<?php 
コード例 #2
0
ファイル: payment_find.php プロジェクト: joseic/sdk-php
<br />
------------------------------------------------------------------------------------------------------------
<br />

<?php 
/* High Level call */
require_once '../lib/Nimble/base/NimbleAPI.php';
$params = array('clientId' => '729DFCD7A2B4643A0DA3D4A7E537FC6E', 'clientSecret' => 'jg26cI3O1mB0$eR&fo6a2TWPmq&gyQoUOG6tClO%VE*N$SN9xX27@R4CTqi*$4EO', 'mode' => 'demo');
$IdPayment = 541;
$NimbleApi = new NimbleAPI($params);
$p = new Payments();
$response = $p->FindPaymentClient($NimbleApi, $IdPayment);
?>
--------------
<?php 
/* Low Level call */
$NimbleApi = new NimbleAPI($params);
$NimbleApi->uri = ConfigSDK::NIMBLE_API_BASE_URL . 'payments/' . $IdPayment;
$NimbleApi->method = 'GET';
$response2 = $NimbleApi->rest_api_call();
?>

<br /><pre>
Response: (var_dump($response))
<?php 
var_dump($response);
?>
<br /><pre>
Response2: (var_dump($response2))
<?php 
var_dump($response2);
コード例 #3
0
ファイル: payment_send.php プロジェクト: joseic/sdk-php
require_once '../lib/Nimble/base/NimbleAPI.php';
$payment = array('amount' => 1010, 'currency' => 'EUR', 'customerData' => 'idSample12345', 'paymentSuccessUrl' => 'https://my-commerce.com/payments/success', 'paymentErrorUrl' => 'https://my-commerce.com/payments/error');
$params = array('clientId' => 'REPLACEME_DEMO_CLIENT_ID', 'clientSecret' => 'REPLACEME_DEMO_CLIENT_SECRET', 'mode' => 'demo');
/**
 * High level call.
 *
 * @param $NimbleApi var is the object returned in the authorization step.
 * @param $payment is an array with parameters about transaction to send.
 */
$NimbleApi = new NimbleAPI($params);
$p = new Payments();
$response = $p->SendPaymentClient($NimbleApi, $payment);
?>

<?php 
/**
 * Low level call.
 *
 * @param $NimbleApi var is the object return in the authorization step.
 * @param $payment is an array with parameters about payment to send.
 */
$NimbleApi = new NimbleAPI($params);
$NimbleApi->uri_oauth = ConfigSDK::OAUTH_URL;
$NimbleApi->setGetfields('?grant_type=client_credentials&scope=PAYMENT');
$NimbleApi->method = 'POST';
$NimbleApi->authorization->buildAuthorizationHeader();
$NimbleApi->rest_api_call();
$NimbleApi->setPostfields(json_encode($payment));
$NimbleApi->uri = ConfigSDK::NIMBLE_API_BASE_URL . 'payments';
$NimbleApi->method = 'POST';
$response2 = $NimbleApi->rest_api_call();