Payment Confirmation

v1/transaction/charge

The service that the credit card payment process is finalized and the relevant amount is withdrawn from the credit card.This service is initializes by Paynet.js or Paynet-custom.js in custom form and embedded form integrations. To use this service, session_id and token_id information that Paynet.js posted to your server are required.

You should perform basic authentication with secret_key to use payment service. See more

https://api.paynet.com.tr/v1/transaction/charge

Parameter Name

Type

Required

Description

session_id

string

Yes

Parameter that Paynet.js attacht to your form.

token_id

string

Yes

Parameter that Paynet.js attacht to your form.

amount

string

Yes

The amount parameter sent to this service is compared with the amount that set with the data-amount parameter when starting the payment process in embedded form or custom forms integration. If the amounts do not match, the payment process cannot be completed and the payment service returns an error. The amount sent to this service should be the same as the amount that set with data-amount in embedded form integration, and the amount set with dataamount in custom forms integration should be multiplied by 100.

transaction_type

char

Yes

Sale or pre-authorization. 1 for sale, 3 for pre-authorisations. The default value is sale.

add_comission_amount

bool

Yes

It is compared with the value that set with the dataadd_commission_amount parameter when starting the payment process in embedded form or custom forms integration. If the values do not match, the payment process cannot be completed, the payment service returns an error.

ratio_code

string

Yes

When starting the payment process in embedded form or custom forms integrations, it is compared with the value that set with the dataratio_code parameter. If the values do not match, the payment process cannot be completed, the payment service returns an error. If the ratio code will not be used, this parameter can be sent as an empty string.

installments

string

Yes

When starting the payment process embedded or custom form integrations, it is compared with the value set with the data-installments parameter. If the values do not match, the payment process cannot be completed, the payment service returns an error. If installment limitation will not be used with this parameter, the value of the parameter can be sent as an empty string.

no_instalment

bool

Yes

When starting the payment process in embedded form or custom form integrations, it is compared with the value set with the data-no_instalment parameter. If the values do not match, the payment process cannot be completed, the payment service returns an error.This value can be set as true or false.

tds_required

bool

Yes

When starting the payment process in embedded form or custom form integrations, it is compared with the value set with the data-tds_required parameter. If the values do not match, the payment process cannot be completed, the payment service returns an error.This value can be set as true or false.

reference_no

string

No

A reference number to be sent by you to associate with the transaction, such as order number, invoice number. If you send the reference number with a unique value, you can check the status of the transaction through the check transaction service, in cases where you cannot get a response from the charge transaction service. In this way, we will be protected from duplicate transaction. In the example below, the session_id and token_id are taken and sent to the payment confirmation service.

is_escrow

bool

No

If you want the transaction to be approved by the company, you should send "true". If the parameter has not been sent, "false" is accepted.

agent_customer_name

string

No

The parameter which you write in this area will be seen as the "Customer's Name". You may write your firm name which you want to be seen by your customer

iban

string

No

It should be entered with a country code (ex "TR") with 26 characters in total.

In the example below, the session_id and token_id are taken and sent to the payment confirmation service.

<?php  
			
$secret_key = "sck_pcs_rMnxDSW/43243434/YAzXXXXXXXXXXXX";
$PostURL = "https://pts-api.paynet.com.tr/v1/transaction/charge";
			
$session_id = $_REQUEST["session_id"];
$token_id 	= $_REQUEST["token_id"];
			
	
$params = array(
 'session_id' => $session_id,
 'token_id' => $token_id,
 'transaction_type' => 1, 
 'amount' => '1500',
 'add_comission_amount' => false,
 'ratio_code' => '',
 'installments' => '',
 'no_instalment' => false,
 'tds_required' => true
);
			
$options = array(
			'http' => array(
					'header'  =>"Accept: application/json; charset=UTF-8\r\n".
					"Content-type: application/json; charset=UTF-8\r\n".
					"Authorization: Basic ".$secret_key,
					'method'  => 'POST',
					'content' => json_encode($params),
					'ignore_errors' => true
					),
			);
			
$context  = stream_context_create($options);
$result = json_decode(@file_get_contents($PostURL, false, $context));
			
if($result->is_succeed == true)
{
  echo "Başarılı";
}
else
{
  echo "Başarısız";
}
			
?>

Last updated