我一直想为我的 Django 网站制作支付系统,但是使用 PayPal 对用户来说似乎更容易,我听说有针对 python 的特殊 API,因此它可以与 Django 一起使用。
例如,有用户帐户和我的帐户,我创建了一个接收器功能,它监听支付网关,每当用户将资金发送到电子邮件时,它就会执行特定的命令。现在我还制作了一个发送者功能,这样我就可以向用户发送资金,现在,如果 API 每当用户看到 Paypal 支付窗口的 HTTP 响应时都会收到电子邮件,我想制作一个功能将其发送到特定的电子邮件。
还有另一个带有代码的示例:
import random
from process import multiprocessing
Users = [ "..." ]
# PayPal:
import SomePayPalApi
def Receiver():
SomePayPalApi.receive_to = SomePayPalApi.current_user.email
while True:
if SomePayPalApi.recieved:
print SomePaypalApi.recieved.amount
print SomePaypalApi.received.email
print SomePaypalApi.Balance
received = True
break
def Sender():
SomePayPalApi.sendto = random.choice(Users)
SomePayPalApi.send()
if __name__ == "__main__":
p1 = Process(target=Receiver)
p2 = Process(target=Sender)
p1.start()
p2.start()
我知道这并不像例子那么简单,但我正在寻找 PayPal 的两个通用功能,付款和接收,我如何在 Django 上实现这个 API?另外,如果可能的话,我如何查看我的帐户收到的金额和帐户余额?我可以使用 Django 的 PayPal Api 文档吗? 如何在 Django-Paypal 库中进行还款?
最佳答案
您是否考虑过使用 django-paypal 作为您安装的应用程序之一?
它看起来适合您的用途,并且可以满足您的需求。
看一下:
https://github.com/spookylukey/django-paypal https://django-paypal.readthedocs.io/en/stable/overview.html
关于python - Paypal 交易 : How to receive and send funds with PayPal API and Django?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39730787/