Paytr Iframe Api Integration: Display The Payment Form in An Iframe
Paytr Iframe Api Integration: Display The Payment Form in An Iframe
STEP 1
Display the Payment Form in an iFrame
Merchant should first request an iframe_token. A server-side POST request is needed.
Token
Mandatory Description Field name / type Limitations & Notes
Calculation
merchant_id
Merchant ID: Your Merchant ID
✓ ✓ (integer)
(Mağaza no) provided by PayTR
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 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