php - Android paypal send payment for login user -


i ask possible send payment login-ed user using paypal? android app simple booking movie ticket system. implement paypal feature top-up current user balance. below php table screenshot.

user account table

paypal verification table

so right now, when login user abc, , top-up using paypal. after payment done, payment suppose send user abc not send, should in order send payment user? furthermore, how able acc_id user account table , update in paypal verification table, mean when click acc_id 1 in user account table link paypal verification table. can see acc_id in paypal verification table 0, not know how achieve that.

in-case if want see php code, here or if want java code can update well. can please help, appreciated!

token.php

<?php include_once 'save.php'; if($_server['request_method'] == 'post' && isset($_post)){ $payment_id = $_post['payment_id']; $state = $_post['state']; $amount = $_post['amount'];  $saveobject = new save(); $saveobject->savepaymentdetail($payment_id, $state, $amount); } ?> 

save.php

<?php include_once 'db.php'; class save{ private $db; public function __construct(){     $this->db = new dbconnect(); } public function savepaymentdetail($payment_id, $state, $amount){     $query = "insert paypal_verification(payment_id, state, amount) values ('$payment_id', '$state', '$amount')";     $inserted = mysqli_query($this->db->getdb(), $query);      if($inserted == 1){         $json = array('success' => '1');     }else{         $json = array('success' => '0');     }     mysqli_close($this->db->getdb());     echo json_encode($json, json_pretty_print); } } ?> 

working

$query = "insert paypal_verification (acc_id, payment_id, state, amount)                select acc_id, '$payment_id', '$state', '$amount' account_details username='abc'"; 

not working

$query = "insert paypal_verification (acc_id, payment_id, state, amount)                select acc_id, '$payment_id', '$state', '$amount' account_details username='$username'"; 

if payment successful here

$json = array('success' => '1'); 

then need update user account table this

  1. get current balance user table

  2. add new amount current balance , update user row.


Comments

Popular posts from this blog

python - Operations inside variables -

Generic Map Parameter java -

arrays - What causes a java.lang.ArrayIndexOutOfBoundsException and how do I prevent it? -