Skip to content

Instantly share code, notes, and snippets.

@jimyhuang
Last active July 25, 2016 08:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jimyhuang/75a93bb87295d9e248e5dea2a2b7b0ce to your computer and use it in GitHub Desktop.
Save jimyhuang/75a93bb87295d9e248e5dea2a2b7b0ce to your computer and use it in GitHub Desktop.
<?php
civicrm_initialize();
$pid = 1; // payment processor id from system
$payment_processor = CRM_Core_BAO_PaymentProcessor::getPayment($pid, 'live');
$contribution_trxn_id = 'ABCDE12345';
if($payment_processor['payment_processor_type'] == 'ALLPAY' || $payment_processor['payment_processor_type'] == 'ALLPAYX'){
if(!empty($payment_processor['url_recur']) && !empty($payment_processor['user_name'])){
$processor = array(
'password' => $payment_processor['password']
'signature' => $payment_processor['signature'],
);
$post_data = array(
'MerchantID' => $payment_processor['user_name'],
'MerchantTradeNo' => $contribution_trxn_id,
'TimeStamp' => time(),
);
_civicrm_allpay_checkmacvalue($post_data, $processor);
$json = FALSE;
$response = _civicrm_allpay_postdata($payment_processor['url_api'], $post_data, $json);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment