2017 © Pedro Peláez
 

library chargeio-php

AffiniPay PHP Library

image

affinipay/chargeio-php

AffiniPay PHP Library

  • Wednesday, May 16, 2018
  • by Affinipay
  • Repository
  • 6 Watchers
  • 2 Stars
  • 74 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 5 Forks
  • 1 Open issues
  • 1 Versions
  • 7300 % Grown

The README.md

chargeio-php

PHP Client Library for the AffiniPay Payment Gateway, (*1)

Installation

Download the PHP client library:, (*2)

git clone git://github.com/charge-io/chargeio-php.git

To use the library in your application, add the following to your PHP script:, (*3)

require_once '/path/to/chargeio-php/lib/ChargeIO.php';

Set up ChargeIO credentials

The library's APIs require credentials to access your merchant data on the AffiniPay servers. You can either:, (*4)

  • Provide credentials as arguments to each API call.
  • Configure the library with default credentials., (*5)

    To set default credentials, call ChargeIO::setCredentials with an AffiniPay_Credentials object. The AffiniPay_Credentials object is instantiated with a public_key and a secret_key., (*6)

    ChargeIO::setCredentials(new AffiniPay_Credentials('', ''));, (*7)

Using AffiniPay hosted fields to create a charge token

You must tokenize all sensitive payment information before you submit it to AffiniPay. On your payment form, use AffiniPay’s hosted fields to secure payment data and call window.AffiniPay.HostedFields.getPaymentToken to create a one-time payment token. See "Creating payment forms using hosted fields". Then, POST the payment token ID to your PHP script., (*8)

Making a charge

Pass an amount and the one-time token ID returned from your payment page to complete a charge., (*9)

    $amount = $_POST['amount'];
    $token_id = $_POST['token_id'];
    $charge = ChargeIO_Charge::create(new ChargeIO_PaymentMethodReference(array('id' => $token_id)), $amount);

Documentation

The latest AffiniPay Payment Gateway API documentation is available at https://developers.affinipay.com/reference/api.html#PaymentGatewayAPI., (*10)

The Versions

16/05 2018

dev-master

9999999-dev

AffiniPay PHP Library

  Sources   Download

MIT

The Requires

  • php >=5.4.0