接受托管定期计费 [英] Accept Hosted Recurring billing

查看:23
本文介绍了接受托管定期计费的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

getHostedPaymentPageRequest 仅提供两种类型的交易来使用以下 XML 为表单生成令牌.

getHostedPaymentPageRequest only provides two types of transaction to generate a token for the form using the following XML.

两种交易类型:

  1. authCaptureTransaction
  2. authOnlyTransaction

<getHostedPaymentPageRequest xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd">
  <merchantAuthentication>
    <name>5KP3u95bQpv</name>
    <transactionKey>346HZ32z3fP4hTG2</transactionKey>
  </merchantAuthentication>
  <transactionRequest>
    <transactionType>authCaptureTransaction</transactionType>
    <amount>20.00</amount>
    <profile>
      <customerProfileId>123456789</customerProfileId>
    </profile>
    <customer>
      <email>ellen@mail.com</email>
    </customer>
    <billTo>
        <firstName>Ellen</firstName>
        <lastName>Johnson</lastName>
        <company>Souveniropolis</company>
        <address>14 Main Street</address>
        <city>Pecan Springs</city>
        <state>TX</state>
        <zip>44628</zip>
        <country>USA</country>
    </billTo>
  </transactionRequest>
  <hostedPaymentSettings>
    <setting>
      <settingName>hostedPaymentReturnOptions</settingName>
      <settingValue>{"showReceipt": true, "url": "https://url-when-continue-button-clicked/receipt", "urlText": "Continue", "cancelUrl": "https://url-when-cancel-button-clicked.com/cancel", "cancelUrlText": "Cancel"}</settingValue>
    </setting>
    <setting>
      <settingName>hostedPaymentButtonOptions</settingName>
      <settingValue>{"text": "Pay"}</settingValue>
    </setting>
    <setting>
      <settingName>hostedPaymentStyleOptions</settingName>
      <settingValue>{"bgColor": "blue"}</settingValue>
    </setting>
    <setting>
      <settingName>hostedPaymentPaymentOptions</settingName>
      <settingValue>{"cardCodeRequired": false, "showCreditCard": true, "showBankAccount": true}</settingValue>
    </setting>
    <setting>
      <settingName>hostedPaymentSecurityOptions</settingName>
      <settingValue>{"captcha": false}</settingValue>
    </setting>
    <setting>
      <settingName>hostedPaymentShippingAddressOptions</settingName>
      <settingValue>{"show": false, "required": false}</settingValue>
    </setting>
    <setting>
      <settingName>hostedPaymentBillingAddressOptions</settingName>
      <settingValue>{"show": true, "required":false}</settingValue>
    </setting>
    <setting>
      <settingName>hostedPaymentCustomerOptions</settingName>
      <settingValue>{"showEmail": false, "requiredEmail": false, "addPaymentProfile": true}</settingValue>
    </setting>
    <setting>
      <settingName>hostedPaymentOrderOptions</settingName>
      <settingValue>{"show": true, "merchantName": "G and S Questions Inc."}</settingValue>
    </setting>
    <setting>
      <settingName>hostedPaymentIFrameCommunicatorUrl</settingName>
      <settingValue>{"url": "https://url-contianing-iframe"}</settingValue>
    </setting>
  </hostedPaymentSettings>
</getHostedPaymentPageRequest>

我应该如何修改 XML 以获取定期计费的表单?因为我没有在接受托管中找到任何实现示例来获取用于定期计费的有效表单令牌.没有提到接受托管文档的重复计费.

How should I modify the XML so that I can get the form for recurring billing? As I did not find any implementation example in accept hosted to get a valid form token for recurring billing. There was not mention of recurring billing the accept hosted documentation.

此外,我使用重定向方法而不是 iframe 方法来显示不返回任何响应的表单.

Also, I am using the redirect method and not the iframe one to display the form which does not return any response as well.

推荐答案

没有一种通过托管表单创建订阅的表单.幸运的是有人已经在他们的论坛上发布了如何执行此操作,我将在此处重新发布:

There is no one form for creating a subscription through the hosted form. Fortunately someone already posted how to do this on their forum which I will repost here:

如果您尝试使用接受托管的表单来创建订阅,您实际上不会使用托管支付页面,在此处进行了描述.

If you are trying to use the Accept hosted forms for creating a subscription, you actually wouldn't use the hosted payment page, described here.

正确的工作流程是使用 API 向客户发出请求个人资料:createCustomerProfileRequest.您只需要他们的电子邮件地址.

The correct workflow is, using the API, make a request for a customer profile: createCustomerProfileRequest. All you need is their email address.

从该调用中获取配置文件 ID 后,您请求一个接受托管的添加个人资料表单的令牌.文档此表单和其他表单位于此处.我什至没有意识到这些形式存在.即使你知道你是什么,也很难在谷歌中找到它们寻找.

After getting the profile id from that call, you make a request for a token for the accept hosted add profile form. Documentation for this form and others is here. I didn't even realize these forms existed. It's hard to find them in google even if you know what you're looking for.

您需要客户资料 ID 才能获取添加付款"的令牌个人资料"表格.

You need the customer profile id to get the token for the "add payment profile" form.

你处理对这个表单客户端的响应,因为你得到来自您设置的 IFrameCommunicator 页面的响应(它适用于付款表格或这些客户资料类型表格相同).这是一个示例.

You handle the response to this form client-side since you are getting the response from the IFrameCommunicator page you set up (it works the same for the payment form or these customer profile type forms). Here's a sample.

然后我调用服务器端代码来创建带有 api 的订阅- 我将客户资料 ID 传递给它,因为老实说我不知道​​表单是否返回新创建的付款资料 ID.如果你有客户资料 ID,您可以检索任何现有的付款资料.因此,仅使用客户资料 ID,我拨打电话以获取付款资料 ID - getCustomerProfileRequest.该调用返回各种各样的东西,包括付款资料.我只是抓住第一.现在有了客户资料 ID 和付款资料id,我可以创建订阅 - ARBCreateSubscriptionRequest.有一些示例可以帮助您形成订阅正确.

I then called server-side code to create the subscription with the api - I pass it the customer profile id because honestly I don't know if the form returns the newly created payment profile id. If you have the customer profile id, you can retrieve any existing payment profiles. So, using just the customer profile id, I make a call to get the payment profile id - getCustomerProfileRequest. That call returns all sorts of stuff including the payment profiles. I just grab the first one. Now with the customer profile id and the payment profile id, I can create a subscription - ARBCreateSubscriptionRequest. There are samples out there to help you form the subscription properly.

最后一点:如果你在沙箱中测试,你需要在获取付款资料 ID 和使用 api 获取订阅.沙箱没有资源来实时处理这些事务.弄清楚这一点花了我几个小时.你可以通读这篇文章来确认,和虽然它更旧,但它仍然是真的:

Final note: if you are testing this in the sandbox, you will need to put a 20 second delay between obtaining a payment profile id and obtaining a subscription using the api. The sandbox does not have the resources to handle these transactions real time. Figuring that out cost me several hours. You can read through this post to confirm, and though it's older, it is still true:

https://community.developer.authorize.net/t5/Integration-and-Testing/E00040-when-Creating-Subscription-from-Customer-Profile/mp/59597#M34176>

这篇关于接受托管定期计费的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆