Skip to content
This repository has been archived by the owner on Mar 4, 2023. It is now read-only.

emreakdas/shopier-payment

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GitHub stars GitHub watchers GitHub forks Github all releases MIT license

logo

Usage

   <?php
    include 'shopierAPI.php'; 
    $shopier = new Shopier('SHOPIER_API_KEY', 'SHOPIER_API_SECRET');
    $shopier->setBuyer([ 
    'id' => '123456',
    'paket' => 'Eti Canga', 
    'first_name' => 'Emre', 'last_name' => 'AKDAŞ', 'email' => 'mail@mail.com', 'phone' => '05555555555']); 
    $shopier->setOrderBilling([
    'billing_address' => 'Cemal Gürsel Caddesi No:544564',
    'billing_city' => 'İstanbul',
    'billing_country' => 'Türkiye',
    'billing_postcode' => '34000',
    ]);
    $shopier->setOrderShipping([
    'shipping_address' => 'Cemal Gürsel Caddesi No:544564', 
    'shipping_city' => 'İstanbul',
    'shipping_country' => 'Türkiye',
    'shipping_postcode' => '34000', 
    ]);
    die($shopier->run('544546545', 50, 'https://siteadi.com/shopierNotify.php'));
  ?>

CallBack Page

  <?php
    $status = $_POST["status"];
    $invoiceId = $_POST["platform_order_id"];
    $transactionId = $_POST["payment_id"];
    $installment = $_POST["installment"];
    $signature = $_POST["signature"];

    $data = $_POST["random_nr"] . $_POST["platform_order_id"] . $_POST["total_order_value"] . $_POST["currency"];
    $signature = base64_decode($signature);
    $expected = hash_hmac('SHA256', $data, $shopierSecret, true);
    if ($signature == $expected) {
      $status = strtolower($status);

      if ($status == "success") {
        //Status success
      } else {
        //Status error
      }
    }
  ?>

Lisans

Shopier API MIT lisansı altında lisanslanan açık kaynaklı bir api'dir.