İade İşlemi

Web Servis İsteği


 	{  
    "version": "1.0",  
	    "apikey": "5d39dca1550747fb9407a17f93489afd",  
    "transactionid": "tx_123456789",  
	    "ReferenceTransactionId": "tx_12345678", 
    "transactiontime": 1443600845,  
    "signature": "a4de0f95233617dc62de3c358251f4b2c1341ad9c050296b00a36e17420ab48c",  
	    "amount": 100,  
	    "currency": "TRY"  
	}  


apackage com.hepsipay.sample;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import com.hepsipay.client.model.request.payment.Refund;
import com.hepsipay.client.model.response.RefundResponse;
import com.hepsipay.client.service.RefundService;
import com.hepsipay.client.type.Currency;
import com.hepsipay.client.util.HepsiPayUtil;

/**
 * 
 * @author Ahmet Faruk Bişkinler,
 * @Support PixelTürk Web Studio, "destek@pixelturk.net"
 *
 */
public class SampleRefund extends Sample {
	private final static Logger logger = LogManager.getRootLogger();
	
	public static void main(String[] args) {
		Refund refundRequest = new Refund();
		refundRequest.setTransactionId(HepsiPayUtil.generateRandomTranstionId()); // Ödemeye Ait Tekil Kodu (Maksimum 40 karakterdir)
		refundRequest.setReferenceTransactionId("tx_466943"); // İade Edilecek Ödemeye Ait Tekil Kod (Maksimum 40 karakterdir)
		refundRequest.setAmount("1,00"); // Toplam İade Tutarı
		refundRequest.setCurrency(Currency.TL.getCode()); // Toplam Ödeme Tutar Birimi
		
		RefundService refundService = new RefundService(hepsiPaySettings);
		RefundResponse refundResponse = refundService.makeRefund(refundRequest);
		
		logger.debug(refundResponse);
	}
	
}


?php 

require_once('config.php');

/**
 * Create Refund Request
 * İade İsteği Oluştur
 */
$request = new \Hepsipay\Request\CreateRefundRequest();

/**
 * Set Options
 * Ayarları Set Et
 */
$request->setOptions($options);

$request->setTransactionTime(time()); // İşlem Zamanı, Varsayılan zaman ise şuan.
$request->setTransactionId("tx_" . rand(100000, 999999)); // Ödemeye Ait Tekil Kodu (Maksimum 40 karakterdir)
$request->setReferenceTransactionId("tx_532998"); // İade Edilecek Ödemeye Ait Tekil Kod (Maksimum 40 karakterdir)
$request->setAmount("12099"); // Toplam İade Tutarı (120,99 TL için 12099 girilmesi gerekmektedir. Diğer örnek: 1 TL için 100 giriniz.)
$request->setCurrency(\Hepsipay\Model\Currency::TL); // Toplam Ödeme Tutar Birimi

/**
 * Make Request
 * İsteği Oluştur
 */
$response = \Hepsipay\Model\Refund::create($request);

/**
 * Print Response ve Request Details
 * Yanıtı ve İstek Detaylarını Yazdır
 */
echo "<pre>";
echo "\nRESPONSE\n\n";
print_r($response); // Response
echo "\nREQUEST\n\n";
print_r($request->toJsonString()); // Request
echo "</pre>";




var request = new RefundRequest
{
	Version = "1.0",
	ApiKey = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJyb2xlIjoxLCJBcGlLZXkiOiJhNTNkZjYwZjUwNmY0MzBjYTRjNzQzNTRkNDU1Y2RlYyJ9.O-eJWMK1sHt3JZgHFsnJp6yyiqmbzdyuOOe0-AvnHzg",
	TransactionId = "TestRefund00002",
	TransactionTime = "1443600845",
	Amount = 5499,
	Currency = "TRY",
	BasketItems = new List
	{
		new RefundBasketItem
		{
			BasketItemId = "BoyamaKalemSeti",
			Amount = 8750,
			MerchantOffsetAmount = 18,
			SubMerchantOffsetAmount = 1
		}
	},
	Customer = new Customer
	{
		Name = "Ahmet",
		Surname = "Mehmet",
		Email = "ahmetmehmet@ahmetmarket.com.tr",
		PhoneNumber = "5337654321",
		Code = "7cefdf61-38cd-4b35-b5f0-4c98c5805d41",
		IpAddress = "127.0.0.1"
	},
	ReferenceTransactionId = "TestSale00002",
	HashVersion = "1.1"
};

var apiUrl = "https://apientgr.hepsipay.com/payments/refund";

var response = _paymentProcessor.Refund(request, apiUrl, "123");

Web Servis Cevabı


{
  "ApiKey": "1ca71cb09c7f4a2188fbddfa90efb481",  
  "TransactionId": " tx_123456789",  
	  "ReferenceTransactionId": "tx_12345678",  
  "TransactionTime": "1447752023",  
  "Signature": "8480954d54d94e5f272c53caa69efdcb0b678e837d3997eec42c4dbfa636cdde",  
  "Currency": "TRY", 
	  "amount": 100,  
  "MessageCode": "0000",  
	  "Message": "Başarılı",
	  "UserMessage": "İşleminiz başarıyla gerçekleştirildi"  
	}  

Ürün veya hizmet arayabilirsiniz.