0% found this document useful (0 votes)
243 views4 pages

Paytr Iframe Api Integration: Display The Payment Form in An Iframe

The document outlines the steps to integrate the PayTR iframe API for payment processing. Step 1 involves: 1) Requesting an iframe token from the PayTR API by sending merchant and order details in a POST request. 2) Displaying the payment form in an iframe on the merchant's site using the iframe token received. 3) Though the user sees the payment form, the integration is not complete until Step 2 is implemented to receive the payment result from PayTR and confirm/cancel the order accordingly.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
243 views4 pages

Paytr Iframe Api Integration: Display The Payment Form in An Iframe

The document outlines the steps to integrate the PayTR iframe API for payment processing. Step 1 involves: 1) Requesting an iframe token from the PayTR API by sending merchant and order details in a POST request. 2) Displaying the payment form in an iframe on the merchant's site using the iframe token received. 3) Though the user sees the payment form, the integration is not complete until Step 2 is implemented to receive the payment result from PayTR and confirm/cancel the order accordingly.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

PAYTR IFRAME API INTEGRATION

STEP 1
Display the Payment Form in an iFrame
Merchant should first request an iframe_token. A server-side POST request is needed.

* Request URL: https://www.paytr.com/odeme/api/get-token


* POST REQUEST FIELDS AND VALUES:

Token
Mandatory Description Field name / type Limitations & Notes
Calculation
merchant_id
Merchant ID: Your Merchant ID
✓ ✓ (integer)
(Mağaza no) provided by PayTR

User ip: User IP received during


the request
Up to 39 characters
✓ ✓ (Important: Make sure you send user_ip (string)
(ipv4)
the external IP address when you
run tests on your local machine)
Merchant order id: The unique
order id you set for the
transaction. Up to 64 characters,
✓ ✓ merchant_oid (string)
(Note: Order number is posted Alpha numeric
back within callback notification
- on STEP 2)
User email address: The email
address which;
a) the user registered with
✓ ✓ email (string) Up to 100 characters
on your system
b) or you received via the
order form
Payment amount: The total For example, 3456
payment_amount
✓ ✓ amount of the order. should be sent for 34.56
(integer)
(Multiply the amount by 100) (34.56 * 100 = 3456)
TL (or TRY), EUR, USD,
✓ ✓ Currency currency(string) GBP, RUB (TL is assumed
if not sent)
Please check the sample
✓ ✓ User basket/order contents user_basket (string)
codes for structure
Do not display the installment
option: If you send as 1, the
installment options are not
✓ ✓ no_installment (int) 0 or 1
displayed (example usage:
installment ban for mobile
phone sales)
Maximum number of
installments: Specifies the 0,2,3,4,5,6,7,8,9,10,11,12
maximum number of If zero (0) is sent, the
✓ ✓ installments to be displayed max_installment (int) maximum available
(example usage: up to 4 installment number is
installments is allowed for used
jewellery expenditures)
✓ Paytr_token: It is used to ensure paytr_token (string) Please check the sample

Sayfa 1 / 2
that the request comes from you codes for calculation
and the content did not change
User name and surname: First
and last name of the user that
✓ user_name (string) Up to 60 characters
you have on your system or
received via the order form
User address: The address of the
user that you have on your
✓ user_address (string) Up to 400 characters
system or received via the order
form
User phone number: The phone
number of the user that you
✓ user_phone (string) Up to 20 characters
have on your system or received
via the order form
The page the user will be
redirected to after successful
payment (e.g. Order status / my
✓ orders page) merchant_ok_url Up to 400 characters
(Warning: the payment may not
have been approved yet when
the user reaches this page)
The page that the user will be
✓ redirected to if something merchant_fail_url Up to 400 characters
unexpected occurs
When the merchant is in live
✓ mode, it can be sent as 1 to run a test_mode 0 or 1
test
Display errors: If the value is 1, 0 or 1
when wrong or incomplete (Be sure to send 1 to
information is transmitted to the debug_on (int) detect errors during the
API, error message is displayed integration and testing
on the page. process)
If a value other than zero is sent,
payment must be completed In minutes
within that time. (e.g. You can timeout_limit(int) (30 minutes is assumed if
use it for security purposes in not sent)
case of price updates etc.)
tr for Turkish or en for
Language to be used on pages
lang(string) English
during payment process
(tr is assumed if not sent)

* The response to the iframe_token request is in JSON format:

- Successful response example: (includes iframe_token)


{"status":"success","token":"28cc613c3d7633cfa4ed0956fdf901e05cf9d9cc0c2ef8db54fa"}

- Failed response example:


{"status": "failed", "reason": "Required field value invalid: merchant_id"}

The following HTML code block should be used to open the payment form. The iframe_token received in the
successful response (explained above) is used in “src” attribute of iFrame.

Sayfa 2 / 2
<script src="https://www.paytr.com/js/iframeResizer.min.js"></script>
<iframe src="https://www.paytr.com/odeme/guvenli/iframe_token" id="paytriframe" frameborder="0"
scrolling="no" style="width: 100%;"></iframe>
<script>iFrameResize({},'#paytriframe');</script>

Upon completion of the steps described above, the payment form should appear on the screen. This step
concludes the part of the payment process which the user will interact with. HOWEVER; the integration is not yet
complete. STEP 2 must be completed in order to receive the payment result (success / failed) and to confirm /
cancel the order.

To complete the integration, please see the document inside STEP 2 folder.

Sayfa 3 / 2

You might also like