telr payment python
1.0.0

このモジュールは、APIのTelrの支払いサービスを実装するためのPIPパッケージです。このモジュールを使用するには、PIPコマンドまたはセットアップでインストールする必要があります。
pip install telr_paymentプロジェクトにパッケージをインポートします。
from telr_payment.api import Telrモジュールを使用するには、例とドキュメントを見ることを検討してください。
簡単に実装するために、トランザクションを作成するための2つの簡単な例と、次のようなチェック用の2つの簡単な例を提供しました。
# order_sample.py
from telr_payment . api import Telr
from pprint import pprint
# if you dont want it to run in test mode change the test option according to docs
telr = Telr ( auth_key = "YOUR_AUTH_KEY" , store_id = "YOUR_STORE_ID" , test = 1 )
order_response = telr . order (
order_id = "ORDER_ID_TOKEN" ,
amount = 54.5 ,
return_url = "http://domain.com/path/to/url" ,
return_decl = "http://domain.com/path/to/url" ,
return_can = "http://domain.com/path/to/url" ,
description = "testing"
)
pprint ( order_response ) # check_sample.py
from telr_payment . api import Telr
from pprint import pprint
# if you dont want it to run in test mode change the test option according to docs
telr = Telr ( auth_key = "YOUR_AUTH_KEY" , store_id = "YOUR_STORE_ID" , test = 1 )
status_response = telr . status (
order_reference = "ORDER_REF_TOKEN"
)
pprint ( status_response )トランザクションをチェックするステータスの表
| ステータスを注文します | 説明 |
|---|---|
| 1 | 保留中 |
| 2 | 承認(認証取引や販売など、取引はキャプチャされていません 保留にされた取引) |
| 3 | 有料(取引された取引、販売取引、保留にされていない) |
| -1 | 期限切れ |
| -2 | キャンセル |
| -3 | 辞退した |
| カード番号 | タイプ | CVV | MPI |
|---|---|---|---|
| 4000 0000 0000 0002 | ビザ | 123 | いいえ |
| 4111 1111 1111 1111 | ビザ | 123 | はい |
| 4444 3333 2222 1111 | ビザ | 123 | はい |
| 4444 4244 4444 4440 | ビザ | 123 | はい |
| 4444 4444 4444 4448 | ビザ | 123 | はい |
| 4012 8888 8888 1881 | ビザ | 123 | はい |
| 5105 1051 0510 5100 | マスターカード | 123 | いいえ |
| 5454 5454 5454 5454 | マスターカード | 123 | はい |
| 5555 5555 5555 4444 | マスターカード | 123 | はい |
| 5555 5555 5555 5557 | マスターカード | 123 | はい |
| 5581 5822 2222 2229 | マスターカード | 123 | はい |
| 5641 8209 0009 7002 | Maestro UK | 123 | はい |
| 6767 0957 4000 0005 | ソロ | 123 | いいえ |
| 3434 343434 34343 | アメリカンエクスプレス | 1234 | いいえ |
| 3566 0020 2014 0006 | JCB | 123 | いいえ |
| 3111 1111 1111 1111 | マダ | 123 | いいえ |
テストカードで使用するカードセキュリティコード(CVV)は123(American Expressを除く、1234である必要があります)は、認定応答のために、他のコードが拒否されます。
MPI列に「はい」を表示するカードは、シミュレートされた3D Secure認証ページを使用して、VisaまたはMasterCard SecureCodeによって検証されたときにトランザクションフローをテストできます。
{ 'method' : 'create' ,
'order' : { 'ref' : 'ORDER_REF_TOKEN' ,
'url' : 'https://secure.telr.com/gateway/process.html?o=ORDER_REF_TOKEN' } ,
'trace' : 'xxxx/xxxx/xxxxxxxx' } {
"method" : "create" ,
"error" : {
"message" : "Exx: Error Name" ,
"note" : "Message according to error"
}
} { 'method' : 'check' ,
'order' : { 'amount' : '4.50' ,
'card' : { 'country' : 'AE' ,
'expiry' : { 'month' : x , 'year' : xxxx } ,
'first6' : 'xxxxxx' ,
'last4' : 'xxxx' ,
'type' : 'Visa Credit' } ,
'cartid' : 'ORDER_ID_TOKEN' ,
'currency' : 'AED' ,
'customer' : { 'address' : { 'city' : 'xxxxx' ,
'country' : 'AE' ,
'line1' : 'xxxx,xxx,xxx' ,
'mobile' : '1234567890' } ,
'email' : '[email protected]' ,
'name' : { 'forenames' : 'FIRST_NAME' , 'surname' : 'LAST_NAME' } } ,
'description' : 'testing' ,
'paymethod' : 'Card' ,
'ref' : 'ORDER_REF_TOKEN' ,
'status' : { 'code' : 3 , 'text' : 'Paid' } ,
'test' : 1 ,
'transaction' : { 'class' : 'ECom' ,
'code' : '924861' ,
'date' : '04 Aug 2022 12:56 GST' ,
'message' : 'Authorised' ,
'ref' : 'REF_TOKEN' ,
'status' : 'A' ,
'type' : 'sale' } } ,
'trace' : 'xxxx/xxxx/xxxxxxxx' } { 'method' : 'check' ,
'order' : { 'amount' : '54.50' ,
'cartid' : 'ORDER_ID_TOKEN' ,
'currency' : 'AED' ,
'description' : 'TRANSACTION_DESCRIPTION' ,
'ref' : 'ORDER_REF_TOKEN' ,
'status' : { 'code' : 1 , 'text' : 'Pending' } ,
'test' : 1 ,
'url' : 'https://secure.telr.com/gateway/process.html?o=ORDER_REF_TOKEN' } ,
'trace' : 'xxxx/xxxx/xxxxxxxx' } { 'method' : 'check' ,
'order' : { 'amount' : '54.50' ,
'cartid' : 'ORDER_ID_TOKEN' ,
'currency' : 'AED' ,
'description' : 'TRANSACTION_DESCRIPTION' ,
'ref' : 'ORDER_REF_TOKEN' ,
'status' : { 'code' : - 2 , 'text' : 'Cancelled' } ,
'test' : 1 } ,
'trace' : 'xxxx/xxxx/xxxxxxxx' }