Provides payment gateway API for http://integralces.net
A PHP API for IntegralCES_interop.
Visit its Drupal integralCES issue.
This consumer is just an example, you don't need to take it all, just the API icesSDKv0.
-
Wrap API entrypoint with your own singleton class and configure it; you will need to get in contact (www.integralces.net) to receive credentials.
-
Get the singleton...
$api = myAPI::get_instance();
...and check for a valid Client (representing your website) connection before start making querys:
$myContextName = $api->check_client_connection();
- Get a login url to redirect your debited user for authentification:
$redirect_url = $api->get_authorization_url( $my_callback_url );
What goes under: a) API will generate a request token by making curl request saving it on a cookie and then use it to return the login url on integralCES server.
b) After successfully login, CES Server will call your API providing an authorization token which will be saved in a cookie.
c) API will then request for an access_token and save it on a cookie.
d) Then, API will redirect to $my_callback_url param.
- Check for your loged user:
$logged_user = $api->Users->get_logged_user();
- Make a payment:
$payment = new integralCES\Payment(); $payment->buyer = $api->Accounts->get( $_POST["txtBuyer"] ); $payment->seller = $api->Accounts->get( $_POST["txtSeller"] ); $payment->amount = $_POST["txtAmount"]; $payment->concept = $_POST["txtConcept"]; $payment = $api->Payments->create( $payment );
NOTICE: iCES Server will check that your buyer is the same that is logged in your site. You can check integralCES\Account created objects before sending payment if need to find errors.
5.1) You can check now for your payment id, state, and any errors notification:
$str_payment = sprintf( "%s, with status %s %s", $payment->id, $payment->get_state(), $payment->result ); $html = str_replace( '%%section_payment_id%%', "Payment id: " . $str_payment, $html );
- Retrieve a single payment by id:
$payment = $api->Payments->get( $payment->id );
- Retrieves a user and render its name and accounts:
$user = $api->Users->get( $my_user_id ); $user->accounts_to_ul()
Testing development server
BTC @ 1DNxbBeExzv7JvXgL6Up5BSUvuY4gE8q4A