Exemplo n.º 1
0
 public function save_stripe_charge($stripe)
 {
     \Stripe\Stripe::setApiKey($this->stripe_private_key);
     // $stripe = $stripe_response->jsonSerialize();
     $charge_obj = $stripe['data']['object'];
     $charge_data = array();
     $charge_data['stripe_id'] = $charge_obj['id'];
     $charge_data['currency'] = $charge_obj['currency'];
     $charge_data['amount'] = $charge_obj['amount'];
     $charge_data['created'] = $charge_obj['created'];
     $bt = \Stripe\BalanceTransaction::retrieve($charge_obj['balance_transaction']);
     $charge_data['amount_converted'] = $bt->amount;
     if ($charge_obj['source']['customer']) {
         $stripe_id = $charge_obj['source']['customer'];
     } else {
         $stripe_id = $charge_obj['id'];
     }
     \adz_stripe_donations\CustomSave::save_stripe_charge_detail($charge_data, $stripe_id);
 }