iyzico / iyzipay-python Goto Github PK
View Code? Open in Web Editor NEWiyzipay api python client
License: MIT License
iyzipay api python client
License: MIT License
Documents state that the conversationId parameter is optional, but it's absence breaks the code
File "/virtenvs/flask/lib/python2.7/site-packages/iyzipay/iyzipay_resource.py", line 216, in to_pki_string
pki_builder = iyzipay.PKIBuilder(self.resource_pki(request))
File "/virtenvs/flask/lib/python2.7/site-packages/iyzipay/iyzipay_resource.py", line 68, in resource_pki
return 'locale=' + request.get('locale') + ',conversationId=' + request.get('conversationId') + ','
TypeError: cannot concatenate 'str' and 'NoneType' objects
Supplying an empty string value works.
callbackURL causes invalid signature in Payment & BasicPayment's to_pki_string functions. Since these functions are about nonsecure payments, there's no need for callbackURL. callbackURL must be removed from these functions.
Merhaba, sandbox ile çalışırken bu hatayı alıyorum. Dökümanlarda ve örnek kodlarda çözümü bulamadım.
Prod ortamında bazı kartlarda geçersiz imza hatası alıyorum. Kartlar internete açık limitleri normal.
Selamlar,
Samples kısmındaki initialize_checkout_form.py geçersiz imza hatası veriyor:
{"status":"failure","errorCode":"1000","errorMessage":"Geçersiz
imza","locale":"tr","systemTime":1572376824669,"conversationId":"123456789"}
callback adresini de değiştirdim ama hata gelmeye devam ediyor. apikey, secretkey ve url girilmiş durumda. sandbox üstünde deniyorum... Aynı Key'ler ile iyzipay.Payment() ise çalışıyor.
Çözüm önerisi varsa dinlemek isterim.
Teşekkürler.
In a Django function view, the function traditionally takes an argument called request
. Like this:
def main(request):
...
In the example in the readme, there is a variable called request
that overwrites it. Solvable, but takes time of the newcomer.
I propose renaming it to payment_request
, or something.
Fiyat parametrelerinde ondalık kısım için 2 haneden fazla girildiğinde "geçersiz imza" hatası alınıyor.
I was having an issue about the 3D Secure Payment initialize. I use this example
https://github.com/iyzico/iyzipay-python/blob/master/samples/initialize_threeds.py
I put my api_key, secret_key, base_url to to file.
But I cannot get html result from threeDSHtmlContent
Here is the result of the (iyzipay.ThreedsInitialize().create(request, options))
{
"status": "success",
"locale": "tr",
"systemTime": 1589877944654,
"conversationId": "123456789",
"threeDSHtmlContent": "PCFkb2N0eXBlIGh0bWw+CjxodG1sIGxhbmc9ImVuIj4KPGhlYWQ+CiAgICA8dGl0bGU+aXl6aWNvIE1vY2sgM0QtU2VjdXJlIFByb2Nlc3NpbmcgUGFnZTwvdGl0bGU+CjwvaGVhZD4KPGJvZHk+Cjxmb3JtIGlkPSJpeXppY28tM2RzLWZvcm0iIGFjdGlvbj0iaHR0cHM6Ly9zYW5kYm94LWFwaS5peXppcGF5LmNvbS9wYXltZW50L21vY2svaW5pdDNkcyIgbWV0aG9kPSJwb3N0Ij4KICAgIDxpbnB1dCB0eXBlPSJoaWRkZW4iIG5hbWU9Im9yZGVySWQiIHZhbHVlPSJtb2NrMTItNDE1NDc3MTYzNzIyOTg2NWl5emlvcmQiPgogICAgPGlucHV0IHR5cGU9ImhpZGRlbiIgbmFtZT0iYmluIiB2YWx1ZT0iNTUyODc5Ij4KICAgIDxpbnB1dCB0eXBlPSJoaWRkZW4iIG5hbWU9InN1Y2Nlc3NVcmwiIHZhbHVlPSJodHRwczovL3NhbmRib3gtYXBpLml5emlwYXkuY29tL3BheW1lbnQvaXl6aXBvcy9jYWxsYmFjazNkcy9zdWNjZXNzLzMiPgogICAgPGlucHV0IHR5cGU9ImhpZGRlbiIgbmFtZT0iZmFpbHVyZVVybCIgdmFsdWU9Imh0dHBzOi8vc2FuZGJveC1hcGkuaXl6aXBheS5jb20vcGF5bWVudC9peXppcG9zL2NhbGxiYWNrM2RzL2ZhaWx1cmUvMyI+CiAgICA8aW5wdXQgdHlwZT0iaGlkZGVuIiBuYW1lPSJjb25maXJtYXRpb25VcmwiIHZhbHVlPSJodHRwczovL3NhbmRib3gtYXBpLml5emlwYXkuY29tL3BheW1lbnQvbW9jay9jb25maXJtM2RzIj4KICAgIDxpbnB1dCB0eXBlPSJoaWRkZW4iIG5hbWU9IlBhUmVxIiB2YWx1ZT0iM2UxYWRlZjUtMWY4ZS00MzEyLTk1ODMtYzExOTQ2MDRjOWMzIj4KPC9mb3JtPgo8c2NyaXB0IHR5cGU9InRleHQvamF2YXNjcmlwdCI+CiAgICBkb2N1bWVudC5nZXRFbGVtZW50QnlJZCgiaXl6aWNvLTNkcy1mb3JtIikuc3VibWl0KCk7Cjwvc2NyaXB0Pgo8L2JvZHk+CjwvaHRtbD4="
}
https://dev.iyzipay.com/tr/odeme-formu/odeme-formu-sonucu
Ödeme formu sonucunun dokümantasyondaki şekliyle alınabileceği yazıyor fakat öyle bir class mevcut değil, bunun yerine CheckoutForm ile denediğimde bu lineda 'locale' değişkeninin yollanmaması errora düşmesine sebep oluyor ama dokümantasyonda zorunluluk hayır verilmiş.
Form oluşturduktan sonra callbackurl'e gelen POST isteğinin payload'ı
{
"token": "60c259bc-3be4-43f8-ae0c-2a579e105673",
"locale": "tr"
}
gibi olduğunda doğru çalışıyor.
I am writing to bring attention to a critical issue regarding the validation of fields during the initialization of the payment form in the Iyzipay payment service. As a prominent payment service, it is crucial to ensure robust validation mechanisms to enhance user experience and facilitate seamless integration.
Problem:
The issue lies in the lack of clear and informative validation messages for the various fields accepted. Specifically, the validation for certain fields is not transparent, leading to confusion and frustration during integration.
Example:
Consider a scenario where a software system sets its testing environment with user emails in the format [email protected]. If the sandbox of Iyzipay cannot accept this format, the service needs to raise a validation error related to this specific field. However, in the current version, the service returns an error message stating "invalid signature," which is unclear and does not provide sufficient information about the root cause of the issue.
Request:
I request that the validation mechanism for the initialization of the payment form be revisited and improved to provide more explicit and user-friendly error messages. This enhancement will greatly benefit developers integrating with Iyzipay by reducing the time spent diagnosing issues and ensuring a smoother overall experience.
Expected Outcome:
Clear and specific validation messages for each field, highlighting the nature of the error.
Informative responses that guide developers in resolving issues efficiently.
Improved documentation regarding field-specific validation requirements.
Steps to Reproduce:
Thank you for your attention to this matter, and I appreciate your efforts in continuously improving the Iyzipay payment service.
API do not support refund v2!
Aynen bu adreste belirtildiği şekilde işlemi yapıyorum, ancak
{"status":"failure","errorCode":"5014","errorMessage":"3dsecure esnasında conversation data decrypt edilemedi","locale":"tr","systemTime":1585411513202,"conversationId":"123456789"}
Şeklinde hata dönüyor. Herhangi bir şifreleme yapmam söylenmiyor dokümantasyon üzerinde vs. Ne yapmam gerekiyor tam olarak?
Not: Birebir aynıdır.
Hi!, I am trying to integrate iyzipay with openedx which is running on python 2.7.
1.0.32
from PyPI1.0.37
Whenever I try to pass special characters i.e some Turkish characters like Ö
, It throws this error
UnicodeEncodeError: 'ascii' codec can't encode character u'\xd6' in position 1: ordinal not in range(128)
The input that I'm passing is,
u'shippingAddress': {u'city': u'G\xd6KHAN', u'address': u'G\xd6KHAN', u'contactName': u'G\xd6KHANG\xd6KHAN', u'country': u'Republic of Turkey'}
The full stack trace of the error is,
payment = iyzipay.Payment().create(request_iyzico, options)
File "/edx/app/ecommerce/venvs/ecommerce/src/iyzipay-python/iyzipay/iyzipay_resource.py", line 290, in create
pki = self.to_pki_string_create(request)
File "/edx/app/ecommerce/venvs/ecommerce/src/iyzipay-python/iyzipay/iyzipay_resource.py", line 305, in to_pki_string_create
pki_builder.append('paymentCard', self.payment_card_pki(request.get('paymentCard')))
File "/edx/app/ecommerce/venvs/ecommerce/src/iyzipay-python/iyzipay/iyzipay_resource.py", line 158, in payment_card_pki
pki_builder.append('cardHolderName', payment_card.get('cardHolderName'))
File "/edx/app/ecommerce/venvs/ecommerce/src/iyzipay-python/iyzipay/pki_builder.py", line 7, in append
self.append_key_value(key, value)
File "/edx/app/ecommerce/venvs/ecommerce/src/iyzipay-python/iyzipay/pki_builder.py", line 26, in append_key_value
self.request_string = self.request_string + key + "=" + str(value) + ","
UnicodeEncodeError: 'ascii' codec can't encode character u'\xd6' in position 1: ordinal not in range(128)
I Know you guys don't support python 2.7 anymore, but if you guys suggest a version that we can use to integrate with python 2.7, it would be really helpful.
P.S: We are looking to onboard 3000 students in our platform. They are going to purchase programs via iyzipay.
I need to get subscribers (customers) and subscription details but SDK is not supported yet. When i read the documentation of subscription feature, it says connect to "blabla" api and send request to "xy" endpoint. But there is no any detail about Authorization header.
Subscription Docs: https://dev.iyzipay.com/en/subscription/SubscriptionApi.pdf
How can I create and delete customer via API call?
Merhabalar,
https://dev.iyzipay.com/tr/api/odeme adresindeki örneği çalıştırmak istiyorum. Aşağıdaki hatayı alıyorum.
File "C:\Users\oguz\Documents\oguz\work\razalt.com\services\repo\mysite\payments\views.py", line 165, in main
payment_auth = iyzipay.PaymentAuth()
AttributeError: module 'iyzipay' has no attribute 'PaymentAuth'
Kütüphaneyi
pip install iyzipay
ile kurdum. Acaba dokümantasyon pip versiyonundan önde mi? Ne yapmak lazım?
Hi,
Updated version is at 1.0.37 but pip is still on 1.0.32. I'm getting error from a concatenate process, I believe it is related. I see the code has changed.
Kütüphanenin
class CheckoutForm(IyzipayResource):
def retrieve(self, request, options): # -> HTTPResponse:
...
def to_pki_string(self, request): # -> str:
...
gibi metodların genel bakışını içeren stub (.pyi) dosyaları var mıdır acaba? En azından hangi fonksiyon hangi değerleri alıp ne döndürüyor görmek hoş olabilir.
Aynen bu adreste belirtildiği şekilde işlemi yapıyorum, ancak 3d secure sayfasını da başarıyla geçtikten sonra
{"status"=>"failure", "error_code"=>"5087", "error_message"=>"Üye işyerine ait ödeme kaydı bulunamadı", "locale"=>"tr", "system_time"=>1635256083213, "conversation_id"=>"123456789"}
bu şekilde hata alıyorum. Bunun sebebi ve çözümü nedir?
Last release version on github: 1.0.37
Pip package version on pypi: 1.0.32
The docs are confusing.
Would you please consider making this code python 2.7 compatible?
Our code base is large and using python 2.7, and it's not possible for us to migrate to 3.x any time soon. Considering your old API is going to be obsolete by July, it would be great if this API was backward (python 2.7) compatible.
At a glance, I can see one main import import http.client
which would prevent it from being backward compatible, and it has a relatively easy solution:
future
libraryfrom future import standard_library
standard_library.install_aliases()
I'll check and try to spot other compatibility issues.
Please let us know what you think.
Here is the error that I'm getting: "Gecersiz Imza":
b'{"status":"failure","errorCode":"1000","errorMessage":"Ge\xc3\xa7ersiz imza","locale":"tr","systemTime":1688561366716,"conversationId":"123456789"}'
You can basically try this on a google colab by installing the iyzipay
!pip install iyzipay
Collecting iyzipay
Downloading iyzipay-1.0.32.tar.gz (13 kB)
Preparing metadata (setup.py) ... done
Building wheels for collected packages: iyzipay
Building wheel for iyzipay (setup.py) ... done
Created wheel for iyzipay: filename=iyzipay-1.0.32-py3-none-any.whl size=9375 sha256=72dcb0f7394f2a10f987d391c7f402a545f62cec1cb1ce420feab6444d170398
Stored in directory: /root/.cache/pip/wheels/da/33/06/da3ef6dd5cdca33353d7aa008f2edc8585944a95ff0536310d
Successfully built iyzipay
Installing collected packages: iyzipay
Successfully installed iyzipay-1.0.32
and use your own api keys, here is the script that I run and got the error.
options = {
'api_key': "xxx",
'secret_key':"xxx",
'base_url': "sandbox-api.iyzipay.com"
}
buyer = {
'id': 'BY789',
'name': 'John',
'surname': 'Doe',
'gsmNumber': '+905350000000',
'email': '[email protected]',
'identityNumber': '74300864791',
'lastLoginDate': '2015-10-05 12:43:35',
'registrationDate': '2013-04-21 15:12:09',
'registrationAddress': 'Nidakule Göztepe, Merdivenköy Mah. Bora Sok. No:1',
'ip': '85.34.78.112',
'city': 'Istanbul',
'country': 'Turkey',
'zipCode': '34732'
}
address = {
'contactName': 'Jane Doe',
'city': 'Istanbul',
'country': 'Turkey',
'address': 'Nidakule Göztepe, Merdivenköy Mah. Bora Sok. No:1',
'zipCode': '34732'
}
basket_items = [
{
'id': 'BI101',
'name': 'Binocular',
'category1': 'Collectibles',
'category2': 'Accessories',
'itemType': 'PHYSICAL',
'price': '0.3'
},
{
'id': 'BI102',
'name': 'Game code',
'category1': 'Game',
'category2': 'Online Game Items',
'itemType': 'VIRTUAL',
'price': '0.5'
},
{
'id': 'BI103',
'name': 'Usb',
'category1': 'Electronics',
'category2': 'Usb / Cable',
'itemType': 'PHYSICAL',
'price': '0.2'
}
]
request = {
'locale': 'tr',
'conversationId': '123456789',
'price': '1',
'paidPrice': '1.2',
'currency': 'TRY',
'basketId': 'B67832',
'paymentGroup': 'PRODUCT',
"callbackUrl": "https://www.merchant.com/callback",
"enabledInstallments": ['2', '3', '6', '9'],
'buyer': buyer,
'shippingAddress': address,
'billingAddress': address,
'basketItems': basket_items,
'debitCardAllowed': True
}
checkout_form_initialize = iyzipay.CheckoutFormInitialize().create(request, options)
print(checkout_form_initialize.read())
Response:
b'{"status":"failure","errorCode":"1000","errorMessage":"Ge\xc3\xa7ersiz imza","locale":"tr","systemTime":1688561366716,"conversationId":"123456789"}'
I think its because of the utf-8 however there is nothing that I can do from my end since it uses iyzipay.CheckoutFormInitialize().create(request, options) so I think there is big problem on that side.
After initializing the checkout form and getting the card information from the user, I get the following error from the API:
errorCode: "5167"
errorMessage: "Ödeme isteği threeDS olmak zorundadır"
status: "failure"
systemTime: 1634850875137
This happens right after the user clicks the "Pay" button.
Merhabalar,
Marketplace üye işyeri için ürün ödemesinde bütün sepet kırılımlarında subMerchantKey gönderilmelidir
Tam olarak böyle bir hata alıyorum. Hesap tipim market place
olarak belirlendi fakat ben standart olarak sanal post gibi satış da yapmak istiyorum. Bu gibi durumlarda nasıl bir hareket sergilemeliyiz.
Teşekkürler.
Looks like for the last 3-4 years there haven't been much of a code change, addition or revision at all. Is this SDK maintainer or are we supposed to fork this and move away from the official SDK?
Issues don't seem to be fixed, code seems heavily bugged, documentation is not really up to date nor enough, PRs are not reviewed nor merged.
If this is no longer under maintenance, please do let me know so that I can just move on to my own fork.
Thanks!
After developments done on the backend side,
API doesn't mention "paymentConversationId" input name.
Hey, contributors and users of iyzipay!
I got SetuptoolsDeprecationWarning on my CI (GitHub actions) environment while I was trying to install the iyzipay package with PyPI. After my research, I found the cause of the problem. The cause of the problem is the "wheel" package, so if you don't have the "wheel" package in your environment, you could probably encounter this error.
Output of error:
Collecting iyzipay
Downloading iyzipay-1.0.32.tar.gz (13 kB)
Preparing metadata (setup.py): started
Preparing metadata (setup.py): finished with status 'error'
error: subprocess-exited-with-error
× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [52 lines of output]
/opt/hostedtoolcache/Python/3.8.14/x64/lib/python3.8/site-packages/setuptools/installer.py:27: SetuptoolsDeprecationWarning: setuptools.installer is deprecated. Requirements should be satisfied by a PEP 517 installer.
× python setup.py bdist_wheel did not run successfully.
│ exit code: 1
╰─> [8 lines of output]
/opt/hostedtoolcache/Python/3.8.14/x64/lib/python3.8/site-packages/setuptools/config/setupcfg.py:[50](https://github.com/actions/runs/3303925358/jobs/5452429015#step:6:51)8: SetuptoolsDeprecationWarning: The license_file parameter is deprecated, use license_files instead.
So, I solved this error with this lines.
python3 -m pip install --upgrade pip
pip install -U pip wheel
The first line is for upgrading the pip.
The second line is for installing the package or updating the package already installed.
Output of commands:
Requirement already satisfied: pip in /opt/hostedtoolcache/Python/3.8.14/x64/lib/python3.8/site-packages (22.3)
Requirement already satisfied: pip in /opt/hostedtoolcache/Python/3.8.14/x64/lib/python3.8/site-packages (22.3)
Collecting wheel
Downloading wheel-0.37.1-py2.py3-none-any.whl (35 kB)
Installing collected packages: wheel
Successfully installed wheel-0.37.1
Collecting iyzipay
Downloading iyzipay-1.0.32.tar.gz (13 kB)
Preparing metadata (setup.py): started
Preparing metadata (setup.py): finished with status 'done'
Also, if the "wheel" package installation didn't work for you, you could try to update or install the "setuptools" package, like below.
python3 -m pip install --upgrade pip
pip install -U pip setuptools wheel
Have a great coding! 🤞
Hi,
I want to understand the concept of the Iyzico and I have experienced some issue and I hope you can help me out.
1- SSL:
I had to use this to overcome SSL cerficaition problem.
Terminal code:
/python3.10/ssl.py", line 1342, in do_handshake
self._sslobj.do_handshake()
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1007)
To overcome this issue, I temporarily did this:
#%% SSL Part
import ssl
import urllib.request
ssl._create_default_https_context = ssl._create_unverified_context
urllib.request.urlopen("https://google.com").read()
2- Working pipeline of Iyzico and models. To understand better I created a visualization:
So what we need to create payment: payment_card, buyer, address and basket_items. These and options creates inside of "iyzipay.Payment().create". However, I still did not get how the process goes. So I also created visual for that:
In samples folder, there is no a simple way of usage I can find. Please help me to find where is this simple process:
1- User comes, selects item, add basket. (So far, it is easy)
2- User goes to checkout, enter credit card info, clicks PayNow(we are assuming), then this information goes to Iyzico. After this, including this, I am lost. Which parameters I useful? How do I check return of Iyzico? I believe we need to confirm some tokens. There are files in the samples folder but there is not any directive guide how to use them.
Problems I am having is lack of direction actually.
Iyzico needs Bin number, why? How do we use them?
What is working pipeline of 3D and non-3D secure?
What are their differences in code-wise?
Where the conversation IDs are created?
Can we generate our unique conversation IDs and baskedIDs? Is there any format we should be take care of for not get fail by Iyzico?
To able to mimic sample code in first page, XXX, I did this:
def r_(barcode, report = True):
if report == True:
print("Current Barcode:", str(barcode))
@router.post("/api/pay", tags=["payments"])
async def create_payment(payment_request: PaymentCardModel,
current_user: dict = Depends(get_current_user)):
print("-----------------")
print("Current User:", current_user["email_DB"])
try:
r_(1)
current_payment_request = payment_request.model_dump()
print("Current Payment Request Dict:", current_payment_request)
r_(2)
# Assuming `test_Buyer`, `test_Address`, and `test_BasketItem` are already populated correctly
# Convert the single basket item to a list for the basketItems field
basket_items_list = [test_BasketItem.model_dump()]
# Structure merged_data with the correct field names and data
merged_data = {
"paymentCard": test_card.model_dump(), # Directly assigning the dictionary of payment card details
"buyer": test_Buyer.model_dump(), # Assuming this returns a dictionary of buyer details
"shippingAddress": test_Address.model_dump(), # Assuming this returns a dictionary of address details
"billingAddress": test_Address.model_dump(), # Re-using the same address for billing; adjust as needed
"basketItems": basket_items_list, # Assigning the list of basket item dictionaries
# Add any other missing fields required by PaymentRequestModel here
}
request = PaymentRequestModel(**merged_data).model_dump()
print("Current request:", request)
r_(3)
payment_response = iyzipay.Payment().create(request, options)
print("Payment Response:", payment_response)
r_(4)
payment_response = json.loads(payment_response.read().decode('utf-8'))
print("Payment Response:", payment_response)
r_(5)
if payment_response.get("status") == "success":
r_(6)
# Handle successful payment
return {"status": "Success", "message": "Payment successful", "paymentResponse": payment_response}
else:
r_(7)
# Handle payment failure
return {"status": "Failure", "message": "Payment failed", "paymentResponse": payment_response}
except HTTPException as e:
return {"status": "Failure", "message": "Payment failed", "paymentResponse": e.detail}
and I used these models:
class PaymentCardModel(BaseModel):
cardHolderName: Optional[str] = 'John Doe'
cardNumber: Optional[str] = '5528790000000008'
expireMonth: Optional[str] = '12'
expireYear: Optional[str] = '2030'
cvc: Optional[str] = '123'
registerCard: Optional[int] = 0
class BuyerModel(BaseModel):
id: Optional[str] = 'BY789'
name: Optional[str] = 'John'
surname: Optional[str] = 'Doe'
gsmNumber: Optional[str] = '+905350000000'
email: Optional[str] = '[email protected]'
identityNumber: Optional[str] = '74300864791'
lastLoginDate: Optional[str] = '2015-10-05 12:43:35'
registrationDate: Optional[str] = '2013-04-21 15:12:09'
registrationAddress: Optional[str] = 'Nidakule Göztepe, Merdivenköy Mah. Bora Sok. No:1'
ip: Optional[str] = '85.34.78.112'
city: Optional[str] = 'Istanbul'
country: Optional[str] = 'Turkey'
zipCode: Optional[str] = '34732'
class AddressModel(BaseModel):
contactName: Optional[str] = 'Jane Doe'
city: Optional[str] = 'Istanbul'
country: Optional[str] = 'Turkey'
address: Optional[str] = 'Nidakule Göztepe, Merdivenköy Mah. Bora Sok. No:1'
zipCode: Optional[str] = '34732'
class BasketItemModel(BaseModel):
id: Optional[str] = 'Gold101'
name: Optional[str] = 'Gold'
category1: Optional[str] = 'Models'
category2: Optional[str] = 'Membership'
itemType: Optional[str] = 'PHYSICAL'
price: Optional[str] = '20.0'
class PaymentRequestModel(BaseModel):
locale: Optional[str] = 'tr'
conversationId: Optional[str] = '123456789'
price: Optional[str] = '20.0'
paidPrice: Optional[str] = '24.0'
currency: Optional[str] = 'TRY'
installment: Optional[int] = 1
basketId: Optional[str] = 'B67832'
paymentChannel: Optional[str] = 'WEB'
paymentGroup: Optional[str] = 'PRODUCT'
paymentCard: PaymentCardModel
buyer: BuyerModel
shippingAddress: AddressModel
billingAddress: AddressModel
basketItems: list[BasketItemModel]
However, result was:
Current User: [email protected]
Current Barcode: 1
Current Payment Request Dict: {'cardHolderName': 'John Doe', 'cardNumber': '5528790000000008', 'expireMonth': '12', 'expireYear': '2030', 'cvc': '123', 'registerCard': 0}
Current Barcode: 2
Current request: {'locale': 'tr', 'conversationId': '123456789', 'price': '20.0', 'paidPrice': '24.0', 'currency': 'TRY', 'installment': 1, 'basketId': 'B67832', 'paymentChannel': 'WEB', 'paymentGroup': 'PRODUCT', 'paymentCard': {'cardHolderName': 'John Doe', 'cardNumber': '5528790000000008', 'expireMonth': '12', 'expireYear': '2030', 'cvc': '123', 'registerCard': 0}, 'buyer': {'id': 'BY789', 'name': 'John', 'surname': 'Doe', 'gsmNumber': '+905350000000', 'email': '[email protected]', 'identityNumber': '74300864791', 'lastLoginDate': '2015-10-05 12:43:35', 'registrationDate': '2013-04-21 15:12:09', 'registrationAddress': 'Nidakule Göztepe, Merdivenköy Mah. Bora Sok. No:1', 'ip': '85.34.78.112', 'city': 'Istanbul', 'country': 'Turkey', 'zipCode': '34732'}, 'shippingAddress': {'contactName': 'Jane Doe', 'city': 'Istanbul', 'country': 'Turkey', 'address': 'Nidakule Göztepe, Merdivenköy Mah. Bora Sok. No:1', 'zipCode': '34732'}, 'billingAddress': {'contactName': 'Jane Doe', 'city': 'Istanbul', 'country': 'Turkey', 'address': 'Nidakule Göztepe, Merdivenköy Mah. Bora Sok. No:1', 'zipCode': '34732'}, 'basketItems': [{'id': 'Gold101', 'name': 'Gold', 'category1': 'Models', 'category2': 'Membership', 'itemType': 'PHYSICAL', 'price': '20.0'}]}
Current Barcode: 3
Payment Response: <http.client.HTTPResponse object at 0x107479ba0>
Current Barcode: 4
Payment Response: {'status': 'failure', 'errorCode': '1000', 'errorMessage': 'Geçersiz imza', 'locale': 'tr', 'systemTime': 1709401195452, 'conversationId': '123456789'}
Current Barcode: 5
Current Barcode: 7
Do not mind the current_user because it is about auth. system of user. That part works. But I send information directly from test data as you can see. This is so weird: "Payment Response: {'status': 'failure', 'errorCode': '1000', 'errorMessage': 'Geçersiz imza', 'locale': 'tr', 'systemTime': 1709401195452, 'conversationId': '123456789'}"
I tried to be specific as much as I can. You can check my current code: https://github.com/OrcunSamiTandogan/paymentSystem
I will be so glad, if you can help me out.
Best!
Systems:
python 3.10.11
Macbook M2.
VScode.
Backend: FastAPI
Frontend: React
Database: MongoDB (not integrated yet)
annotated-types==0.6.0
anyio==4.2.0
bcrypt==4.1.2
cachetools==5.3.2
certifi==2024.2.2
cffi==1.16.0
charset-normalizer==3.3.2
click==8.1.7
cryptography==42.0.3
dnspython==2.6.0
exceptiongroup==1.2.0
fastapi==0.109.2
google-auth==2.28.0
h11==0.14.0
httpcore==1.0.3
httpx==0.26.0
idna==3.6
jwt==1.3.1
passlib==1.7.4
pyasn1==0.5.1
pyasn1-modules==0.3.0
pycparser==2.21
pydantic==2.6.1
pydantic_core==2.16.2
PyJWT==2.8.0
pymongo==4.6.1
python-multipart==0.0.9
requests==2.31.0
rsa==4.9
sniffio==1.3.0
starlette==0.36.3
typing==3.7.4.3
typing_extensions==4.9.0
urllib3==1.26.7
uuid==1.30
uvicorn==0.27.1
numpy
boto3==1.28.57
botocore==1.31.57
python-dotenv
services
iyzipay
certifi
Django ile kullanmaya çalıştığım zaman ödeme işlemi gerçekleştikten sonra döndüğüm sayfada isteğin post olarak gelmesi sonucu 403(CSRF) hatası alıyorum. Yardımcı olabilir misiniz?
In our tests, API returns encode/decode errors for the unicode
objects when the object contains non ascii chars like 'ÖöŞşÇçİıĞğÜü', however it works fine with unicode
objects when chars are in ascii range.
All of the test files here on github uses typed str
objects, so they pass. However if you make an API call using a unicode
object, for example if you change the address as such: u'Nidakule Göztepe, Merdivenköy Mah. Bora Sok. No:1'
it fails while building the pki string (because there are direct string casts like str(value)
). It only fails when the object contains none ascii chars.
We tried converting unicode
objects to str
before passing them to API (encoding utf-8), but we still get encode/decode errors because of the multiple casts.
In any case, nearly all of the big Python frameworks (like Django) rely on unicode and for a good reason. I believe it would be a much better practice if the API would work with unicode objects without a problem.
Please let us know If you think this error is on our part, if not, can you please add coverage for unicode objects. This problem keeps us stuck.
Looking forward to your guidance.
Thank you.
To reproduce the problem
address = dict([('address', u'Nidakule Göztepe, Merdivenköy Mah. Bora Sok. No:1')])
Hello, in case the is no endpoint, I was wondering if it's possible to retrieve the email of the user associated with a payment using the payment ID. This would be useful to solve the initial problem where i need to check if a payment attached to a certain email was successful or not. If this is not currently possible, is there any other way to achieve this? Thank you for your help.
Yazdığım Resource
class SubscriptionFormInitialize(IyzipayResource):
def create(self, request, options):
pki = self.to_pki_string(request)
return self.connect('POST', '/v2/subscription/checkoutform/initialize', options, request, pki)
def to_pki_string(self, request):
pki_builder = iyzipay.PKIBuilder(self.resource_pki(request))
pki_builder.append('callbackUrl', request.get('callbackUrl'))
pki_builder.append('pricingPlanReferenceCode', request.get('pricingPlanReferenceCode'))
pki_builder.append('subscriptionInitialStatus', request.get('subscriptionInitialStatus'))
pki_builder.append('name', request.get('name'))
pki_builder.append('surname', request.get('surname'))
pki_builder.append('email', request.get('email'))
pki_builder.append('gsmNumber', request.get('gsmNumber'))
pki_builder.append('identityNumber', request.get('identityNumber'))
pki_builder.append('shippingAddress', self.address_pki(request.get('shippingAddress')))
pki_builder.append('billingAddress', self.address_pki(request.get('billingAddress')))
return pki_builder.get_request_string()
Yazdığım Örnek
options = {
'api_key': '-------',
'secret_key': '-------',
'base_url': 'sandbox-api.iyzipay.com'
}
address = {
'contactName': 'Jane Doe',
'city': 'Istanbul',
'country': 'Turkey',
'address': 'Nidakule Göztepe, Merdivenköy Mah. Bora Sok. No:1',
'zipCode': '34732'
}
request = {
'locale': 'tr',
'conversationId': '123456789',
"callbackUrl": "https://www.merchant.com/callback",
'pricingPlanReferenceCode': '864dea9b-6f1b-4933-bce2-1ca4673a148f',
'name': 'John',
'surname': 'Doe',
'email': '[email protected]',
'gsmNumber': '+905350000000',
'identityNumber': '74300864791',
'shippingAddress': address,
'billingAddress': address,
}
iyzico_cevap = iyzipay.SubscriptionFormInitialize().create(
request, options).read().decode('utf-8')
Oluşan Pki String
[locale=tr,conversationId=123456789,callbackUrl=https://www.merchant.com/callback,referenceCode=864dea9b-6f1b-4933-bce2-1ca4673a148f,name=John,surname=Doe,email=[email protected],gsmNumber=+905350000000,identityNumber=74300864791,shippingAddress=[address=Nidakule Göztepe, Merdivenköy Mah. Bora Sok. No:1,zipCode=34732,contactName=Jane Doe,city=Istanbul,country=Turkey],billingAddress=[address=Nidakule Göztepe, Merdivenköy Mah. Bora Sok. No:1,zipCode=34732,contactName=Jane Doe,city=Istanbul,country=Turkey]]
Aldığım Cevap
{'status': 'failure', 'errorCode': '100001', 'errorMessage': 'Sistem hatası', 'systemTime': 1624444765292}
adds pos order id to payment resource
Merhaba,
Herhangi bir kart bilgisi girdiğimde ve repoda bulunan create_payment örneğini düzenleyip çalıştırdığımda bu hatayı alıyorum:
{"status":"failure","errorCode":"5010","errorMessage":"İşlemi 3dsecure olarak gerçekleştirmeniz gerekmektedir","locale":"tr","systemTime":1677360825440,"conversationId":"123456789"}
Yardımcı olabilir misiniz?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.