<p>总有付款方式:<a href="https://github.com/abunsen/Paython" rel="nofollow">https://github.com/abunsen/Paython</a></p>
<p>目前支持5+支付网关:</p>
<ol>
<li>授权.net</li>
<li>第一个数据/链接点</li>
<li>创新网关(来自intuit)</li>
<li>插头式</li>
<li>条纹</li>
</ol>
<p>下面是一个例子:</p>
<pre><code>from paython import CreditCard, AuthorizeNet
</code></pre>
<p>先办一张卡:</p>
<pre><code>credit_card = CreditCard(
number = '4111111111111111',
exp_mo = '02',
exp_yr = '2012',
first_name = 'John',
last_name = 'Doe',
cvv = '911',
strict = False
)
</code></pre>
<p>检查其是否有效:</p>
<pre><code>if not credit_card.is_valid(): return 'houston, we have a problem' # checks card number + expiration date
</code></pre>
<p>设置要收费的客户数据,并非所有字段都是必需的:</p>
<pre><code>customer_data = dict(
address='123 Main St',
address2='Apt 1',
city='Pleasantville',
state='IA',
zipcode='54321',
country='US',
phone='654-369-9589',
email='john@localwoodshop.com',
ip='127.0.0.1')
</code></pre>
<p>针对网关授权,选项包括调试输出或测试凭据:</p>
<pre><code> api = AuthorizeNet(username='test', password='testpassword', debug=True, test=True)
gateway_response = api.auth(amount='0.05', credit_card=credit_card, billing_info=customer_data, shipping_info=None)
</code></pre>
<p>现在你可以解决:</p>
<pre><code> api = AuthorizeNet(username='test', password='testpassword', debug=True, test=True)
gateway_response = api.settle(amount='0.05', trans_id='2156729380')
</code></pre>