Advertisement
Guest User

Untitled

a guest
Mar 21st, 2019
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.58 KB | None | 0 0
  1. $input = @file_get_contents("php://input");
  2. $event_json = json_decode($input, true);
  3.  
  4. if ($event_json['type'] == 'checkout.session.completed') {
  5.     $uniqid = $event_json['data']['object']['client_reference_id'];
  6.     $customerId = $event_json['data']['object']['customer'];
  7.  
  8.     $dir = BASE_PATH . '/files/orders/';
  9.     $orderFile = $dir . $uniqid . '.json';
  10.     $json = json_decode(file_get_contents($orderFile), true);
  11.  
  12.     $company = $companyMapper->get($json['companyId']);
  13.     $company = $companyMapper->getByVat($company['vat']);
  14.  
  15.     if($company->getStripeId() !== $customerId){
  16.         return false;
  17.     }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement