购物车上的 PayPal 快速结账

发布于 2024-09-05 23:17:14 字数 2910 浏览 0 评论 0原文

我希望实现: alt text

所以在我的购物车页面中我设置会话(“Payment_Amount”)=总计 并下载了向导告诉我的两个 asp 文件。 expresschecout.asppaypalfunctions.asp。并将 API 凭据添加到正确的位置。 我从他们的向导中添加表单:

<form action='expresscheckout.asp' METHOD='POST'>
<input type='image' name='submit' src='https://www.paypal.com/en_US/i/btn/btn_xpressCheckout.gif' border='0' align='top' alt='Check out with PayPal'/>
</form>

但是当我进入购物车并按 paypal 提交按钮时,我会被带到expressheckout.asp,但页面保持白色,状态栏中显示“完成”。我该如何调试呢? :/

编辑添加我的代码,ASP:

<!-- #include file ="paypalfunctions.asp" -->
<%
' ==================================
' PayPal Express Checkout Module
' ==================================

On Error Resume Next

'------------------------------------
' The paymentAmount is the total value of 
' the shopping cart, that was set 
' earlier in a session variable 
' by the shopping cart page
'------------------------------------
paymentAmount = Session("Payment_Amount")

'------------------------------------
' The currencyCodeType and paymentType 
' are set to the selections made on the Integration Assistant 
'------------------------------------
currencyCodeType = "USD"
paymentType = "Sale"

'------------------------------------
' The returnURL is the location where buyers return to when a
' payment has been succesfully authorized.
'
' This is set to the value entered on the Integration Assistant 
'------------------------------------
returnURL = "http://www.noamsm.co.il/index.asp"

'------------------------------------
' The cancelURL is the location buyers are sent to when they click the
' return to XXXX site where XXX is the merhcant store name
' during payment review on PayPal
'
' This is set to the value entered on the Integration Assistant 
'------------------------------------
cancelURL = "http://www.noamsm.co.il/index.asp"

'------------------------------------
' Calls the SetExpressCheckout API call
'
' The CallShortcutExpressCheckout function is defined in the file PayPalFunctions.asp,
' it is included at the top of this file.
'-------------------------------------------------
Set resArray = CallShortcutExpressCheckout (paymentAmount, currencyCodeType, paymentType, returnURL, cancelURL)

ack = UCase(resArray("ACK"))
If ack="SUCCESS" Then
    ' Redirect to paypal.com
    ReDirectURL( resArray("TOKEN") )
Else  
    'Display a user friendly Error on the page using any of the following error information returned by PayPal
    ErrorCode = URLDecode( resArray("L_ERRORCODE0"))
    ErrorShortMsg = URLDecode( resArray("L_SHORTMESSAGE0"))
    ErrorLongMsg = URLDecode( resArray("L_LONGMESSAGE0"))
    ErrorSeverityCode = URLDecode( resArray("L_SEVERITYCODE0"))
End If
%>

我猜我从底部收到错误之一,但找不到在哪里可以看到 thm..

i wish to achieve: alt text

so in my shopping cart page i set session("Payment_Amount") = total
and downloaded both asp files the wizard told me. expresschecout.asp and paypalfunctions.asp. and added the API credentials to the corect place.
and i add the form from their wizard:

<form action='expresscheckout.asp' METHOD='POST'>
<input type='image' name='submit' src='https://www.paypal.com/en_US/i/btn/btn_xpressCheckout.gif' border='0' align='top' alt='Check out with PayPal'/>
</form>

But when i go to my shopping cart and press on the paypal submit button i am taken to expressheckout.asp but the page stays whit, saying Done in the status bar. how can i debug that? :/

EDIT ADDED MY CODE, ASP:

<!-- #include file ="paypalfunctions.asp" -->
<%
' ==================================
' PayPal Express Checkout Module
' ==================================

On Error Resume Next

'------------------------------------
' The paymentAmount is the total value of 
' the shopping cart, that was set 
' earlier in a session variable 
' by the shopping cart page
'------------------------------------
paymentAmount = Session("Payment_Amount")

'------------------------------------
' The currencyCodeType and paymentType 
' are set to the selections made on the Integration Assistant 
'------------------------------------
currencyCodeType = "USD"
paymentType = "Sale"

'------------------------------------
' The returnURL is the location where buyers return to when a
' payment has been succesfully authorized.
'
' This is set to the value entered on the Integration Assistant 
'------------------------------------
returnURL = "http://www.noamsm.co.il/index.asp"

'------------------------------------
' The cancelURL is the location buyers are sent to when they click the
' return to XXXX site where XXX is the merhcant store name
' during payment review on PayPal
'
' This is set to the value entered on the Integration Assistant 
'------------------------------------
cancelURL = "http://www.noamsm.co.il/index.asp"

'------------------------------------
' Calls the SetExpressCheckout API call
'
' The CallShortcutExpressCheckout function is defined in the file PayPalFunctions.asp,
' it is included at the top of this file.
'-------------------------------------------------
Set resArray = CallShortcutExpressCheckout (paymentAmount, currencyCodeType, paymentType, returnURL, cancelURL)

ack = UCase(resArray("ACK"))
If ack="SUCCESS" Then
    ' Redirect to paypal.com
    ReDirectURL( resArray("TOKEN") )
Else  
    'Display a user friendly Error on the page using any of the following error information returned by PayPal
    ErrorCode = URLDecode( resArray("L_ERRORCODE0"))
    ErrorShortMsg = URLDecode( resArray("L_SHORTMESSAGE0"))
    ErrorLongMsg = URLDecode( resArray("L_LONGMESSAGE0"))
    ErrorSeverityCode = URLDecode( resArray("L_SEVERITYCODE0"))
End If
%>

i am guessing i am getting one of the errors from the bottom but cant find where to see thm..

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

亣腦蒛氧 2024-09-12 23:17:14

目前尚不清楚您遇到的具体问题是什么,但以下是您需要完成的事件顺序才能使用 PayPal 快速结账付款方式。这一系列事件的上下文将是您的购物车或快速结帐按钮所在的任何页面。

  • 创建 ExpressCheckOut 类的实例

  • 设置 ExpressCheckOut 类的 ApiSignature、UserName、Password、Environment、APIVersion、OrderAmount、OrderItemDetails、CancelUrl、ReturnUrl。

    >

  • 调用 ExpressCheckout 并获取 ExpressCheckoutResponse。

  • 检查 ExpressCheckoutResponse 对象是否成功或失败。

  • 如果成功,则使用您从 ExpressCheckoutResponse 对象收到的令牌将用户重定向到正确的 PayPal 端点。

    如果成功,

希望这能让您清楚地了解如何正确使用此 PayPal api。

享受!

Its a bit unclear as to what the specific problem you are having is, but here is the sequence of events you need to complete in order to use the PayPal express checkout method of payment. This sequence of events' context would be your shopping cart or whatever page your express checkout button is on.

  • Create an instance of the ExpressCheckOut class

  • Set ApiSignature, UserName, Password, Environment, APIVersion, OrderAmount, OrderItemDetails, CancelUrl, ReturnUrl of the ExpressCheckOut class.

  • Call ExpressCheckout and get a ExpressCheckoutResponse.

  • Check the ExpressCheckoutResponse object for success or failure.

  • If success then redirect user to the correct PayPal endpoint with the token you received from the ExpressCheckoutResponse object.

Hope this gives you some clarity on how to correctly use this PayPal api.

Enjoy!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文