Exemplo n.º 1
0
 /**
  * Create a PBM link
  *
  * @since 1.0.0
  * @param Icepay_Pbm_Object $pbmObject
  * @return string
  */
 public function createLink(Icepay_Pbm_Object $pbmObject)
 {
     $this->validateSettings();
     $linkObj = new StdClass();
     $linkObj->merchantid = $this->getMerchantID();
     $linkObj->timestamp = $this->getTimestamp();
     $linkObj->amount = $pbmObject->getAmount();
     $linkObj->currency = $pbmObject->getCurrency();
     $linkObj->language = $pbmObject->getLanguage();
     $linkObj->orderid = $pbmObject->getOrderID();
     $linkObj->country = $pbmObject->getCountry();
     $linkObj->description = $pbmObject->getDescription();
     $linkObj->reference = $pbmObject->getReference();
     $linkObj->checksum = $this->generateChecksum($linkObj);
     $result = $this->generateURL($linkObj);
     return json_decode($result);
 }
Exemplo n.º 2
0
 *  but not limited to the warranties of merchantability, fitness for
 *  a particular purpose and non-infringement. In no event shall the
 *  authors or copyright holders be liable for any claim, damages or
 *  other liability, whether in an action of contract, tort or otherwise,
 *  arising from, out of or in connection with the software or the use
 *  of other dealings in the software.
 *
 */
// Define your ICEPAY Merchant ID and Secret code. The values below are sample values and will not work, Change them to your own merchant settings.
define('MERCHANTID', 'xxxxxx');
define('SECRETCODE', 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx');
// Include the API into your project
require_once '../src/icepay_api_pbm.php';
try {
    /* Set the payment */
    $pbmObj = new Icepay_Pbm_Object();
    $pbmObj->setCurrency('EUR')->setAmount(200)->setCountry('NL')->setLanguage('NL')->setDescription('Test API')->setReference('API REFERENCE')->setOrderID('pbm1000001');
    // Order ID does not work yet.
    $pbm = Icepay_Api_Pbm::getInstance();
    $pbm->setMerchantID(MERCHANTID)->setSecretCode(SECRETCODE);
    $result = $pbm->createLink($pbmObj);
    if (true === $result->success) {
        echo $result->url;
    } else {
        echo $result->errorCode . '<br />';
        echo $result->errorMessage;
    }
} catch (Exception $e) {
    echo $e->getCode() . '<br />';
    echo $e->getMessage();
}