接受托管定期结算 [英] Accept Hosted Recurring billing

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

问题描述

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,以便获得用于定期计费的表格?由于我在host上没有找到任何实现示例,因此无法获得有效的表单令牌来进行重复计费.没有提到定期对接受的托管文档开帐单.

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后,您请求 托管的添加配置文件表单的令牌.有关的文件 此表单和其他表单位于此处.我什至没有意识到这些形式 存在.即使您知道自己的身份,也很难在Google中找到它们 寻找.

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天全站免登陆