나는 내 레일 웹 애플 리케이션에 페이팔을 통합하고 있습니다. 다음 구현 사례가 필요합니다.Paypal 적응 형 지불 자동화 된 흐름의 레일
- 고객이 서비스를 구입하여 내 앱에 지불합니다.
- 예를 들어 일주일에 며칠 후에, 나는 유료 서비스 제공 업체에 비용을 지불합니다. 이 포인트 2는 고객에게 지불 할 날짜가 왔는지 자동으로 확인하는 엔진이 있습니다. 그렇다면 공급자에게 자동으로 지불하려고 시도합니다.
나는 포인트 1을 구현하고 익스프레스 체크 아웃으로 작업하고 있습니다. 제 2 점은 적응 지불 API를 사용해야한다는 것입니다. 그러나, 나는 이해하지 못했기 때문에 잘 모르겠습니다.
내 첫 번째 질문은 모든 것이 자동화되기를 원합니다. 그래서 어떤 것을 확인하기 위해 팝업 창이 나타나기를 원하지 않습니까? 자동으로 작업을 실행할 수 있습니까?
내 코드 :
def pay(amount, paypalAccountEmail)
# ## Build request object
@pay_request = @api.build_pay()
# The action for this request. Possible values are:
#
# * PAY - Use this option if you are not using the Pay request in
# combination with ExecutePayment.
# * CREATE - Use this option to set up the payment instructions with
# SetPaymentOptions and then execute the payment at a later time with
# the ExecutePayment.
# * PAY_PRIMARY - For chained payments only, specify this value to delay
# payments to the secondary receivers; only the payment to the primary
# receiver is processed.
@pay_request.actionType = "PAY"
# URL to redirect the sender's browser to after
# canceling the approval for a payment; it is always required but only
# used for payments that require approval (explicit payments)
@pay_request.cancelUrl = "https://paypal-sdk-samples.herokuapp.com/adaptive_payments/pay"
# The code for the currency in which the payment is
# made; you can specify only one currency, regardless of the number of
# receivers
@pay_request.currencyCode = "EUR"
# The payer of PayPal fees. Allowable values are:
#
# * SENDER - Sender pays all fees (for personal, implicit simple/parallel payments; do not use for chained or unilateral payments)
# * PRIMARYRECEIVER - Primary receiver pays all fees (chained payments only)
# * EACHRECEIVER - Each receiver pays their own fee (default, personal and unilateral payments)
# * SECONDARYONLY - Secondary receivers pay all fees (use only for chained payments with one secondary receiver)
@pay_request.feesPayer = "SENDER"
# The URL to which you want all IPN messages for this payment to be sent.
@pay_request.ipnNotificationUrl = "https://paypal-sdk-samples.herokuapp.com/adaptive_payments/ipn_notify"
# Amount to be paid to the receiver.
@pay_request.receiverList.receiver[0].amount = amount
# Receiver's email address. This address can be unregistered with paypal.com. If so, a receiver cannot claim the payment until a PayPal account is linked to the email address. The PayRequest must pass either an email address or a phone number.
@pay_request.receiverList.receiver[0].email = paypalAccountEmail
# The URL to which the sender's browser is redirected after approving a payment on paypal.com. Specify the URL with the HTTP or HTTPS designator.
@pay_request.returnUrl = "https://paypal-sdk-samples.herokuapp.com/adaptive_payments/pay"
# ## Make API call & get response
@pay_response = @api.pay(@pay_request)
# ## Access Response
# ### Success Response
if @pay_response.responseEnvelope.ack == "Success"
# Once you get success response, user has to redirect to PayPal
# for the payment. Construct redirectURL as follows,
# `redirectURL=https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_ap-payment&paykey="
# + @pay_response.payKey;`
# The pay key, which is a token you use in other Adaptive
# Payment APIs (such as the Refund Method) to identify this
# payment. The pay key is valid for 3 hours; the payment must
# be approved while the pay key is valid.
puts @pay_response.payKey
# The status of the payment. Possible values are:
#
# * CREATED - The payment request was received; funds will be transferred once the payment is approved
# * COMPLETED - The payment was successful
# * INCOMPLETE - Some transfers succeeded and some failed for a parallel payment or, for a delayed chained payment, secondary receivers have not been paid
# * ERROR - The payment failed and all attempted transfers failed or all completed transfers were successfully reversed
# * REVERSALERROR - One or more transfers failed when attempting to reverse a payment
# * PROCESSING - The payment is in progress
# * PENDING - The payment is awaiting processing
puts "Pay Key : " + @pay_response.paymentExecStatus
# ###Error Response
else
puts @pay_response.error[0].message
end
@pay_response
end
내 로그 :
providerPayment-->begin
Request[post]: https://svcs.sandbox.paypal.com/AdaptivePayments/Pay
Response[200]: OK, Duration: 1.417s
AP-1E607027P7722991V
Pay Key : CREATED
providerPayment-->ok
나는 페이팔에서 예를했다하지만 난 그것을 실행할 때, 나는 결과가 괜찮 참조하십시오. 내 actionType = "PAY". 그래서 나는 돈을주고 싶다. 그러나 열쇠에서, 나는 = 창조되고 그 후 아무 일도 일어나지 않는다. 나는 창조하고 싶지 않지만 거래를 완료하고 싶지 않습니다. 내가 뭘 놓치고 있니?
Adaptative payment flow가 말하는대로 작동하는 경우이 API는 저에게 적합하지 않습니다.위의 사용 사례를 참조하십시오. 클라이언트는 이미 급행 결제 일을 지불했습니다. 일주일 후, 나는 공급자에게 돈을 지불해야하며 이것은 자동적이어야합니다. 내 사이트 (내 페이팔 비즈니스 계정, 공급자 계정)에서 지불하는 것입니다. 아무도 결제를 인증하기 위해 로그인해야합니다 ... 알고 계시다면 다른 API 또는 방법을 사용해야하는지 알려 주시기 바랍니다. – Rober
아, 죄송합니다. 간과 한 것 같습니다. 예, 리디렉션 및 추가 승인없이 진행되도록 Pay 요청을 암시 적으로 승인 할 수 있습니다. 나에게 최소한의 시간을 주면 그걸 샘플로 요청 해줄거야. –
암묵적 지불을하기 위해 요청에 senderEmail을 포함하면됩니다. 샘플을 사용하여 답변을 업데이트했습니다. –