You get a bonus - 1 coin for daily activity. Now you have 1 coin

Simplify_SystemException with message System error occurred processing a request

Practice




Simplify_SystemException with message System error occurred processing a request

error during checkout

if you use this payment system

https://www.simplify.com/commerce/login/auth


require_once("./lib/Simplify.php");

Simplify::$publicKey = 'YOUR_PUBLIC_API_KEY';
Simplify::$privateKey = 'YOUR_PRIVATE_API_KEY';

$payment = Simplify_Payment::createPayment(array(
'amount' => '1000',
'description' => 'payment description',
'invoice' => '[INVOICE ID]',
'card' => array(
'expMonth' => '8',
'expYear' => '16',
'cvc' => '123',
'number' => '5555555555554444'
)
));

if ($payment->paymentStatus == 'APPROVED') {
echo "Payment approved ";
}



'[INVOICE ID]', must be unique, and the way it works is: first you get a token in js or php,
then you register the order together with the card data and the payment amount; on success (APPROVED) a successful result is returned, otherwise it is rejected


$res=array('info'=>'ok','result'=>'');
try {

$cardToken = Simplify_CardToken::createCardToken(array(
'card' => array(
// 'addressState' => 'MO',
'expMonth' => $d['cc-exp-month'],
'expYear' => $d['cc-exp-year'],
// 'addressCity' => 'OFallon',
'cvc' => $d['cc-cvc'],
'number' => $d['cc-number']
)
));


$товарinfo=цена;

$orderdata=array(
'amount' => $Giftinfo['price'].'00',
'token' => $cardToken->id,
'description' => 'Покупка '.$товарinfo['name'].' '.Yii::app()->user->firstname.' '.Yii::app()->user->lastname,
'reference' => time() , // make bill id
// 'invoice' => rand(5, 1500),
'currency' => 'USD'
) ;
}catch (Simplify_ApiException $e) {

$code= "Reference: " . $e->getReference() . " ";
$code.= "Message: " . $e->getMessage() . " ";
$code.= "Error code: " . $e->getErrorCode() . " ";
if ($e instanceof Simplify_BadRequestException && $e->hasFieldErrors()) {
foreach ($e->getFieldErrors() as $fieldError) {
$code.= $fieldError->getFieldName()
. ": '" . $fieldError->getMessage()
. "' (" . $fieldError->getErrorCode()
. ") ";
}
}

$res=array('info'=>'error','result'=>$code);

}




try {

$payment = Simplify_Payment::createPayment($orderdata, $public_key, $secret_key );


$data['myid']=$myid;
$data['autor']=$myid;
// $data['systemId']=$myid;
// var_dump($cardToken->card->type);
$data['gid']=$d['gid'];


$data['amount']=$orderdata['amount']/100;
$data['paysystem']='simplify';
$data['cartsystem']=$cardToken->card->type;
$data['last4']=$cardToken->card->last4;
if ($payment->paymentStatus == 'APPROVED') $data['statusId']=100; else $data['statusId']=1;
$data['systemStatusId']=$payment->paymentStatus;
$data['payId']=$payment->id;


$code='ok';
/* echo "Payment approved ";*/





} catch (Simplify_ApiException $e) {

$code= "Reference: " . $e->getReference() . " ";
$code.= "Message: " . $e->getMessage() . " ";
$code.= "Error code: " . $e->getErrorCode() . " ";
if ($e instanceof Simplify_BadRequestException && $e->hasFieldErrors()) {
foreach ($e->getFieldErrors() as $fieldError) {
$code.= $fieldError->getFieldName()
. ": '" . $fieldError->getMessage()
. "' (" . $fieldError->getErrorCode()
. ") ";
}
}

$res=array('info'=>'error','result'=>$code);

}

Comments

To leave a comment

If you have any suggestion, idea, thanks or comment, feel free to write. We really value feedback and are glad to hear your opinion.
To reply

Lectures and tutorial on "Running server side scripts using PHP as an example (LAMP)"

Terms: Running server side scripts using PHP as an example (LAMP)