英文:
How to create recurrings payments with paypal api
问题
我正在努力实施一个需要设置初始付款和无限循环付款令牌的支付系统,但需要在不依赖订阅模块的情况下实现这一目标。具体来说,我正在寻找在欧盟地区内的解决方案。
以下是关键要求:
-
循环付款:我希望设置一个循环付款结构,客户定期(例如,每月)支付特定金额。
-
初始付款:在循环付款协议开始时应进行初始付款。这可以是一次性设置费用或循环付款的第一笔付款。
-
无限循环付款:循环付款应无限期继续,没有预定的结束日期。协议应足够灵活,允许付款持续进行,直到取消。
-
欧盟地区:解决方案需要符合欧洲联盟(EU)地区的法规和标准。
我了解到PayPal提供了用于处理循环付款的订阅模块,但在这种情况下,我正在寻找一种不依赖于该模块的替代方法。我会感激任何关于如何在欧盟地区内使用PayPal API或其他合适方法实现这一目标的指导或建议。
谢谢您提前的帮助!
当我使用/v1/payments/payment
创建付款时,我会收到一个付款令牌。但是,使用此令牌,我只能使用/v1/payments/payment/{payment_id}/execute
端点执行一次付款。
API文档非常令人困惑。/v3/vault/payment-tokens
仅允许在美国使用,唯一的替代方法似乎是订阅模块,这不是我所寻找的。
有什么建议吗?
英文:
I'm working on implementing a payment system that requires the ability to set up recurring payments with an initial payment and a token for infinite recurring payments. However, I need to achieve this without relying on the subscription module. Specifically, I'm looking for a solution within the EU region.
Here are the key requirements:
Recurring Payments: I want to set up a recurring payment structure where the customer is billed periodically (e.g., monthly) for a specific amount.
Initial Payment: There should be an initial payment made at the start of the recurring payment agreement. This could be a one-time setup fee or the first installment of the recurring payments.
Infinite Recurring Payments: The recurring payments should continue indefinitely without a predetermined end date. The agreement should be flexible enough to allow the payments to be ongoing until canceled.
EU Region: The solution needs to comply with the regulations and standards of the European Union (EU) region.
I understand that PayPal provides a subscription module for handling recurring payments, but in this case, I'm looking for an alternative method that doesn't rely on that module. I would appreciate any guidance or recommendations on how to achieve this using the PayPal API or any other suitable approach within the EU region.
Thank you in advance for your help!
When I create an payment with the /v1/payments/payment
I receive a payment token. But with this token I can execute the payment only once with the /v1/payments/payment/{payment_id}/execute
endpoint.
The api docs are very confusing. The /v3/vault/payment-tokens
are only allowed in the US and the only alternative seems to be the subscription module, which is not what I am looking for.
Any idea?
答案1
得分: 1
问题
PayPal订阅集成API文档并不令人困惑,只是你不熟悉整体情况。让我们来分解一下。
通用开发流程
供应商
- 注册和登录到Paypal沙箱帐户
- 转到Sandbox帐户并获取业务帐户信息(电子邮件和密码)
- 转到计划管理(使用业务帐户登录)
- 创建产品(为您的产品分配一个ID)
- 创建计划(PayPal将生成计划ID)
- 通过设置计划ID集成Paypal按钮(JS)
- 设置WebHook以侦听PayPal事件(例如,当进行重复付款时收到通知)
客户
- 创建订阅(PayPal将生成订阅ID)
- 暂停订阅
- 取消订阅(无法重新激活)
基本上,就是这样。
如果您希望在PHP中集成API
您可能需要这个cURL-PHP转换器
- 使用您的(客户端ID和秘密ID)从Paypal获取访问令牌
- 设置cURL请求头
Content-Type: application/json
(将内容发送为JSON)Accept: application/json
Authorization: Bearer YOUR_ACCESS_TOKEN
- 设置您的客户端URL(cURL)
- 获取API文档中的cURL
- 转换cURL-PHP
- 根据您的需求自定义cURL,但是对于必需标头,您必须包括
- 执行cURL
- 听取PayPal HTTP响应
- 将数据保存到您的数据库
额外信息
- 查看
json_decode()
和json_encode()
用于PHP
不客气。如果您需要详细解释,请告诉我。
英文:
Issue
The PayPal Subscription Integration API documentation is not confusing, just that you are not familiar with the big picture. Let's break it down.
General Dev Workflow
Vendor
- Register & Login to Paypal sandbox account
- Go to Sandbox Account and get the business account information (email & password)
- Go to Plan Management (login using the business account)
- Create Products (Give your product an ID)
- Create Plans (PayPal will generate plan ID)
- Integrate the Paypal button in JS by setting the Plan ID
- Setup WebHook to listen to PayPal events (e.g. receive a notification when a recurring payment is made)
Customer
- Create Subscription (PayPal will generate a subscription ID)
- Suspend (pause) Subscription
- Cancel Subscription (cannot reactivate)
Basically, that's it.
If you wish to integrate the API in PHP
You might need this cURL-PHP converter
- get access token from Paypal using your (client ID & secret ID)
- setup cURL request header
Content-Type: application/json
(sending the content as JSON)Accept: application/json
Authorization: Bearer YOUR_ACCESS_TOKEN
- setup your client URL (cURL)
- get cURL at API documentation
- convert cURL-PHP
- tailor as you wish for cURL but for the required header, you must include
- execute cURL
- Listen to PayPal HTTP response
- Save data to your database
Extra
- look into
json_decode()
&json_encode()
for PHP
You're welcome. If you need detail explanation, do let me know
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论