Logo

Ortak Ödeme

Bu metot dinero ödeme sisteminde bir ödeme linki oluşturur. Oluşturulan ödeme link adresine müşterinizi yönlendirerek ödeme alabilirsiniz. Bu servis iki adımdan oluşmaktadır.

  • 1. Link Oluşturun
  • 2. Müşteriyi Ortak Ödeme Sayfasına Yönlendirin
  • 3. Ödeme Bildirimini Karşılayın
Uyarı 1 * : Risk birimi siteniz ile siparişten gelen ürünleri karşılaştırır bu nedenle ürün adlarını doğru göndermeniz önemli.
Uyarı 2 * : Doğru bilgi gönderiniz. Fraud kontrol geçemez ödemeler askıda kalır.
İstek Url https://www.dinero.com.tr/api/v1/payment/link
İstek Tipi POST form-data
İstek Yanıtı application/json
userName string 200 Evet Api Kullanıcı Adı
password string 200 Evet Api password
shopCode string 5 Evet İşyeri Kodu
productName string 200 Evet Uyarı 1 Sepetli sipariş ise, Sepet Adı, Fatura Adı, Tek Ürün ise tam ürün adı.
productData array - Evet Uyarı 1 Sepet içeriğindeki ürünleri dizi yada nesne olarak gönderiniz.
productType string - Evet
DIJITAL_URUNFIZIKSEL_URUN
Ürünlerinizi kargo ile teslim edecekseniz FIZIKSEL_URUN dijital teslimat olan bir ürün satıyorsanız DIJITAL_URUN olarak gönderiniz.
productsTotalPrice decimal - Evet Siparişe ait sepetteki ürünlerin toplam tutarı.
orderPrice decimal - Evet Api üzerinden geçecek nihai tutar. Taksit oranları bu tutar üzerine eklenerek hesaplanır.
currency string 3 Evet
TRYUSDEUR
Para birimi. Varsayılan TRY
orderID string 50 Evet İlgili siparişinizin sizin sisteminiz tarafındaki sipariş ID yada Sipariş Kodu. Ödenmemiş bir sipariş yada benzersiz olmalıdır.
locale string 2 Evet
trendefrar
Varsayılan tr
conversationId string 200 Opsiyonel İstekte gönderilirse response olarak size geri döndürülür. Request/response eşlemesi yapmak için kullanılır.
buyerName string 100 Evet Uyarı 2Sipariş Sahibi Adı
buyerSurName string 100 Evet Uyarı 2Sipariş Sahibi Soyadı
buyerGsmNo string 20 Evet Uyarı 2Sipariş Sahibi Telefon Numarası
buyerEmail email 100 Evet Uyarı 2Sipariş Sahibi E-Posta adresi
buyerIp ipv4/ipv6 - Evet Uyarı 2Sipariş Sahibi IP Adresi
buyerAdress string 200 Evet Sipariş Sahibi Adresi
buyerCountry string 50 Evet Sipariş Sahibi Ülke
buyerCity string 50 Evet Sipariş Sahibi Şehir
buyerDistrict string 50 Evet Sipariş Sahibi İlçe
hash string - Evet orderId . currency . orderPrice . productsTotalPrice.productType . callbackOkUrl . callbackFailUrl değişkenlerinden birleştirilerek oluşturulan metnin işyeri hash kodunuzla şifrelenmiş halidir. Örnek Kod İnceleyiniz.
callbackOkUrl string|url 100 Evet Müşterinin başarılı işlemde yönlendirileceği sayfa
callbackFailUrl string|url 100 Evet Müşterinin başarısız işlemde yönlendirileceği sayfa
Başarılı Yanıt
{
        'status' => 'success',
        'errorMessage' => '',
        'payment_page_url' => https://www.dinero.com.tr/pay/1234567890,
        'payment_page_url_domestic_card' => https://www.dinero.com.tr/pay/1234567890/kredi-karti,
        'payment_page_url_bank_transfer_card' => https://www.dinero.com.tr/pay/banka-havale,
        'payment_page_url_international_card' => https://www.dinero.com.tr/pay/1234567890/kredi-karti-dunya,
        'DineroOrderNumber' => 'yourOrderId',
        'DineroOrderId' => 1234567890
}
Başarısız Yanıt
{
        'status' => 'error',
        'errorMessage' => 'Hata Açıklaması',
}

Örnek Kod

$orderData = [
        'userName' => $this->apiUser,
        'password' => $this->apiKey,
        'shopCode' => $this->shopCode,
        'productName' => $data['productName'] ?? '',
        'productData' => $data['productData'] ?? '',
        'productType' => $data['productType'] ?? '',
        'productsTotalPrice' => $data['productsTotalPrice'] ?? '',
        'orderPrice' => $data['orderPrice'] ?? '',
        'currency' => $data['currency'] ?? '',
        'orderId' => $data['orderId'] ?? '',
        'locale' => $data['locale'] ?? '',
        'conversationId' => $data['conversationId'] ?? '',
        'buyerName' => $data['buyerName'] ?? '',
        'buyerSurName' => $data['buyerSurName'] ?? '',
        'buyerGsmNo' => $data['buyerGsmNo'] ?? '',
        'buyerIp' => $data['buyerIp'] ?? '',
        'buyerMail' => $data['buyerMail'] ?? '',
        'buyerAdress' => $data['buyerAdress'] ?? '',
        'buyerCountry' => $data['buyerCountry'] ?? '',
        'buyerCity' => $data['buyerCity'] ?? '',
        'buyerDistrict' => $data['buyerDistrict'] ?? '',
        'callbackOkUrl' => $data['callbackOkUrl'] ?? '',
        'callbackFailUrl' => $data['callbackFailUrl'] ?? '',
        'module' => $data['module'] ?? '',
    ];

    $orderData['hash'] = $this->generateHash($orderData['orderId'] . $orderData['currency'] . $orderData['orderPrice'] . $orderData['productsTotalPrice'] . $orderData['productType'] . $orderData['callbackOkUrl'] . $orderData['callbackFailUrl']);

    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $this->apiBaseUrl . '/create-payment-link');
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($orderData));
    curl_setopt($ch, CURLOPT_FRESH_CONNECT, true);
    curl_setopt($ch, CURLOPT_TIMEOUT, 20);
    curl_setopt($ch, CURLOPT_REFERER, $_SERVER['SERVER_NAME']);
    curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
    $resultBody = curl_exec($ch);
    $httpStatus = curl_getinfo($ch, CURLINFO_HTTP_CODE);

    if ($responseArr['status'] == 'success' && isset($responseArr['payment_page_url']))
    {
        return [
            'status' => 'success',
            'message' => 'message',
            'redirectUrl' => $responseArr['payment_page_url'],
        ];
    }
    else
    {
        return [
            'status' => 'success',
            'message' => $responseArr['errorMessage'],
            'redirectUrl' => '',
        ];
    }
Müşteriyi ihtiyacınıza göre yanıtda aldığınız linklerden birine yönlendirin
  • payment_page_url
  • payment_page_url_domestic_card
  • payment_page_url_bank_transfer_card
  • payment_page_url_international_card
Sistem bir ödeme başarılı yada başarısız olduğunda alan adı kaydederken eklediğiniz Callback Url adresine bir post isteği gönderir.

İstek Url "Webhook karşılama Url adresiniz"
İstek Tipi POST form-data
İstek Yanıtı application/html || application/text
Parametreler Örnek Alabileceği Değerler
status success success
paymentStatus paymentOk paymentVerification paymentWait paymentNotPaid
hash aHR0cHM6Ly93d3cuZGluZXJvLmNvbS50ci9kZXYvbGlua1BheW1lbnQ= orderId . paymentCurrency . paymentAmount . productsTotalPrice . productType . shopCode . {hashAnahtarınız}
verileri uç uca eklenerek oluşturulan imzadır
paymentCurrency TRY Para Birimi
paymentAmount 149.90 Ödeme Tutarı
paymentType KART KART BANKA_HAVALE YURT_DISI
paymentTime 2025-06-01 21:54:47 Ödeme Tarihi Y-m-d H:i:s
conversationId 123456 Link oluşturken bildirdiğiniz conversationId
orderId 123456 Link oluşturken bildirdiğiniz orderId
shopCode 999999 İşyeri Kodunuz
orderPrice 149.90 Sipariş Tutarı
productsTotalPrice 149.90 Sepet ürünler toplam tutarı
dineroOrderNumber 5434313 Dinero Ödeme Numarası
dineroOrderId 65165156 Dinero Ödeme Idsi
productType FIZIKSEL_URUN Ürün Tipi
callbackOkUrl https://www.websiteniz.com/paymentOk Link oluşturken bildirdiğiniz başarılı url adresi
callbackFailUrl https://www.websiteniz.com/paymentFail Link oluşturken bildirdiğiniz başarısız url adresi
customerPaymentAmount 149.90 Müşterinin kartından geçen nihai tutar
cardMask 520019*******4141 Maskeli Kart Numarası
cardType BONUS Kart Markası
cardUserIp 144.122.199.90 Kart 3d ip adresi
cardHolder AHMET DERE Kart sahibi Ad Soyad
bankMessage - Banka Mesajı

Örnek Kod

public function webHook()
    {
        $post = [];
        $post['status'] = $_POST['status'] ?? '';
        $post['paymentStatus'] = $_POST['paymentStatus'] ?? '';
        $post['hash'] = $_POST['hash'] ?? '';
        $post['paymentCurrency'] = $_POST['paymentCurrency'] ?? '';
        $post['paymentAmount'] = $_POST['paymentAmount'] ?? '';
        $post['paymentType'] = $_POST['paymentType'] ?? '';
        $post['paymentTime'] = $_POST['paymentTime'] ?? '';
        $post['conversationId'] = $_POST['conversationId'] ?? '';
        $post['orderId'] = $_POST['orderId'] ?? '';
        $post['shopCode'] = $_POST['shopCode'] ?? '';
        $post['orderPrice'] = $_POST['orderPrice'] ?? '';
        $post['productsTotalPrice'] = $_POST['productsTotalPrice'] ?? '';
        $post['productType'] = $_POST['productType'] ?? '';
        $post['callbackOkUrl'] = $_POST['callbackOkUrl'] ?? '';
        $post['callbackFailUrl'] = $_POST['callbackFailUrl'] ?? '';

        if (empty($post['status']) || empty($post['paymentStatus']) || empty($post['hash']) || empty($post['paymentCurrency']) || empty($post['paymentAmount']) || empty($post['paymentType']) || empty($post['orderId']) || empty($post['shopCode']) || empty($post['orderPrice']) || empty($post['productsTotalPrice']) || empty($post['productType']) || empty($post['callbackOkUrl']) || empty($post['callbackFailUrl']))
        {
            exit('Eksik Form Datası');
        }

        $hashString = $post['orderId'] . $post['paymentCurrency'] . $post['orderPrice'] . $post['productsTotalPrice'] . $post['productType'] . $this->shopCode . $this->hashKey;
        $MY_HASH = base64_encode(pack('H*', sha1($hashString)));
        if ($MY_HASH !== $post['hash'])
        {
            exit('Hash imzası geçersiz');
        }

        $paymentCheck = $this->checkPayment($post['orderId']);

        if ($paymentCheck['paymentStatus'] == 'paymentOk')
        {
            /*Ödeme Başarılı,sisteminize işleyin*/

            exit('OK');
        }
        else
        {
            /*Ödeme başarısız sisteminize işleyin*/
            exit('OK');
        }

    }

    public function checkPayment(string $orderId, int $dineroOrderId)
    {
        $postData = [
            'dineroOrderId' => $dineroOrderId ?? null,
            'orderId' => $orderId ?? null,
        ];
        $postData['hash'] = $this->generateHash($postData['orderId'] ?? '' . $postData['dineroOrderId'] ?? '');

        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $this->apiBaseUrl . '/check-payment/' . $orderId);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_POST, 1);
        curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($postData));
        curl_setopt($ch, CURLOPT_FRESH_CONNECT, true);
        curl_setopt($ch, CURLOPT_TIMEOUT, 20);
        curl_setopt($ch, CURLOPT_REFERER, $_SERVER['SERVER_NAME']);
        curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
        $resultBody = curl_exec($ch);

        $resultArray = json_decode($resultBody, true);

        return [
            'status' => $resultArray['status'] ?? null,
            'paymentStatus' => $resultArray['paymentStatus'] ?? null,
            'hash' => $resultArray['hash'] ?? null,
            'paymentCurrency' => $resultArray['paymentCurrency'] ?? null,
            'paymentAmount' => $resultArray['paymentAmount'] ?? null,
            'paymentType' => $resultArray['paymentType'] ?? null,
            'paymentTime' => $resultArray['paymentTime'] ?? null,
            'conversationId' => $resultArray['conversationId'] ?? null,
            'orderId' => $resultArray['orderId'] ?? null,
            'shopCode' => $resultArray['shopCode'] ?? null,
            'orderPrice' => $resultArray['orderPrice'] ?? null,
            'productsTotalPrice' => $resultArray['productsTotalPrice'] ?? null,
            'dineroOrderNumber' => $resultArray['dineroOrderNumber'] ?? null,
            'dineroOrderId' => $resultArray['dineroOrderId'] ?? null,
            'productType' => $resultArray['productType'] ?? null,
            'callbackOkUrl' => $resultArray['callbackOkUrl'] ?? null,
            'callbackFailUrl' => $resultArray['callbackFailUrl'] ?? null,
            'bankMessage' => $resultArray['bankMessage'] ?? null,
            'cardMask' => $resultArray['cardMask'] ?? null,
            'cardType' => $resultArray['cardType'] ?? null,
            'cardUserIp' => $resultArray['cardUserIp'] ?? null,
            'cardHolder' => $resultArray['cardHolder'] ?? null,
        ];
    }
public function webHook()
    {
        $post = [];
        $post['status'] = $_POST['status'] ?? '';
        $post['paymentStatus'] = $_POST['paymentStatus'] ?? '';
        $post['hash'] = $_POST['hash'] ?? '';
        $post['paymentCurrency'] = $_POST['paymentCurrency'] ?? '';
        $post['paymentAmount'] = $_POST['paymentAmount'] ?? '';
        $post['paymentType'] = $_POST['paymentType'] ?? '';
        $post['paymentTime'] = $_POST['paymentTime'] ?? '';
        $post['conversationId'] = $_POST['conversationId'] ?? '';
        $post['orderId'] = $_POST['orderId'] ?? '';
        $post['shopCode'] = $_POST['shopCode'] ?? '';
        $post['orderPrice'] = $_POST['orderPrice'] ?? '';
        $post['productsTotalPrice'] = $_POST['productsTotalPrice'] ?? '';
        $post['productType'] = $_POST['productType'] ?? '';
        $post['callbackOkUrl'] = $_POST['callbackOkUrl'] ?? '';
        $post['callbackFailUrl'] = $_POST['callbackFailUrl'] ?? '';

        if (empty($post['status']) || empty($post['paymentStatus']) || empty($post['hash']) || empty($post['paymentCurrency']) || empty($post['paymentAmount']) || empty($post['paymentType']) || empty($post['orderId']) || empty($post['shopCode']) || empty($post['orderPrice']) || empty($post['productsTotalPrice']) || empty($post['productType']) || empty($post['callbackOkUrl']) || empty($post['callbackFailUrl']))
        {
            exit('Eksik Form Datası');
        }

        $hashString = $post['orderId'] . $post['paymentCurrency'] . $post['orderPrice'] . $post['productsTotalPrice'] . $post['productType'] . $this->shopCode . $this->hashKey;
        $MY_HASH = base64_encode(pack('H*', sha1($hashString)));
        if ($MY_HASH !== $post['hash'])
        {
            exit('Hash imzası geçersiz');
        }

        $paymentCheck = $this->checkPayment($post['orderId']);

        if ($paymentCheck['paymentStatus'] == 'paymentOk')
        {
            /*Ödeme Başarılı,sisteminize işleyin*/

            exit('OK');
        }
        else
        {
            /*Ödeme başarısız sisteminize işleyin*/
            exit('OK');
        }

    }

    public function checkPayment(string $orderId, int $dineroOrderId)
    {
        $postData = [
            'dineroOrderId' => $dineroOrderId ?? null,
            'orderId' => $orderId ?? null,
        ];
        $postData['hash'] = $this->generateHash($postData['orderId'] ?? '' . $postData['dineroOrderId'] ?? '');

        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $this->apiBaseUrl . '/check-payment/' . $orderId);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_POST, 1);
        curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($postData));
        curl_setopt($ch, CURLOPT_FRESH_CONNECT, true);
        curl_setopt($ch, CURLOPT_TIMEOUT, 20);
        curl_setopt($ch, CURLOPT_REFERER, $_SERVER['SERVER_NAME']);
        curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
        $resultBody = curl_exec($ch);

        $resultArray = json_decode($resultBody, true);

        return [
            'status' => $resultArray['status'] ?? null,
            'paymentStatus' => $resultArray['paymentStatus'] ?? null,
            'hash' => $resultArray['hash'] ?? null,
            'paymentCurrency' => $resultArray['paymentCurrency'] ?? null,
            'paymentAmount' => $resultArray['paymentAmount'] ?? null,
            'paymentType' => $resultArray['paymentType'] ?? null,
            'paymentTime' => $resultArray['paymentTime'] ?? null,
            'conversationId' => $resultArray['conversationId'] ?? null,
            'orderId' => $resultArray['orderId'] ?? null,
            'shopCode' => $resultArray['shopCode'] ?? null,
            'orderPrice' => $resultArray['orderPrice'] ?? null,
            'productsTotalPrice' => $resultArray['productsTotalPrice'] ?? null,
            'dineroOrderNumber' => $resultArray['dineroOrderNumber'] ?? null,
            'dineroOrderId' => $resultArray['dineroOrderId'] ?? null,
            'productType' => $resultArray['productType'] ?? null,
            'callbackOkUrl' => $resultArray['callbackOkUrl'] ?? null,
            'callbackFailUrl' => $resultArray['callbackFailUrl'] ?? null,
            'bankMessage' => $resultArray['bankMessage'] ?? null,
            'cardMask' => $resultArray['cardMask'] ?? null,
            'cardType' => $resultArray['cardType'] ?? null,
            'cardUserIp' => $resultArray['cardUserIp'] ?? null,
            'cardHolder' => $resultArray['cardHolder'] ?? null,
        ];
    }
1