Google Checkout 订阅问题
我正在尝试在 Google Checkout 中创建订阅。订阅已创建,但在周期结束时而不是开始时收费。我承认我只等了几个小时来确保它能够充电,所以如果我只需要多给它一段时间,请告诉我。
我尝试完全匹配代码,如下所示:http://code .google.com/apis/checkout/developer/Google_Checkout_Beta_Subscriptions.html#Google_Handled_Subscriptions
有没有人能够将此开始充电不充电结束?
我有以下代码:
string digitalContent = "Congratulations! Your subscription is being set up. Feel free to log onto <a href='{0}'>{0}</a> and try it out!";
digitalContent = String.Format(digitalContent, String.Format(ConfigurationManager.AppSettings["ContinueShoppingUrl"], this.Transaction.ID));
CheckoutShoppingCartRequest Req = GCheckoutButton1.CreateRequest();
Req.ContinueShoppingUrl = String.Format(ConfigurationManager.AppSettings["ContinueShoppingUrl"], this.Transaction.ID);
Req.EditCartUrl = ConfigurationManager.AppSettings["EditCartUrl"];
SubscriptionPayment payment = new SubscriptionPayment();
payment.MaximumCharge = 0;
payment.Times = 12;
Subscription subscription = new Subscription();
subscription.Period = GCheckout.AutoGen.DatePeriod.MONTHLY;
subscription.Type = SubscriptionType.google;
subscription.StartDate = DateTime.Now;
subscription.NoChargeAfter = DateTime.Now.AddMonths(12);
ShoppingCartSubscriptionItem subscriptionItem = new ShoppingCartSubscriptionItem();
subscriptionItem.Price = 0;
subscriptionItem.Name = "Subscription to [redacted]";
subscriptionItem.Description = "Subscription to [redacted]";
subscriptionItem.Quantity = 1;
subscriptionItem.Subscription = subscription;
subscriptionItem.DigitalContent = new DigitalItem(digitalContent, false);
ShoppingCartSubscriptionItem subscriptionItem2 = new ShoppingCartSubscriptionItem();
subscriptionItem2.Name = "";
subscriptionItem2.Description = this.Transaction.ID.ToString();
subscriptionItem2.Quantity = 1;
payment.MaximumCharge = 15.00M;
subscriptionItem2.Price = 15.00M;
subscription.RecurrentItem = subscriptionItem2;
subscription.AddSubscriptionPayment(payment);
Req.AddItem(subscriptionItem);
GCheckoutResponse Resp = Req.Send();
生成以下 xml:
<?xml version="1.0" encoding="utf-8" ?>
- <checkout-shopping-cart xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://checkout.google.com/schema/2">
- <shopping-cart>
- <items>
- <item>
- <subscription no-charge-after="2012-06-28T06:54:15.9492-07:00" period="MONTHLY" start-date="2011-06-28T06:54:15.9492-07:00" type="google">
- <payments>
- <subscription-payment times="12">
<maximum-charge currency="USD">15.00</maximum-charge>
</subscription-payment>
</payments>
- <recurrent-item>
<tax-table-selector />
<item-name />
<item-description>3119988d-9ce4-43d2-b2a4-6f9bf1fe6a78</item-description>
<unit-price currency="USD">15.00</unit-price>
<quantity>1</quantity>
</recurrent-item>
</subscription>
- <digital-content>
<description>Congratulations! Your subscription is being set up. Feel free to log onto <a href='[redacted]/Transactions/3119988d-9ce4-43d2-b2a4-6f9bf1fe6a78'>[redacted]/Transactions/3119988d-9ce4-43d2-b2a4-6f9bf1fe6a78</a> and try it out!</description>
<display-disposition>PESSIMISTIC</display-disposition>
</digital-content>
<tax-table-selector />
<item-name>Subscription to Escrow Coordinator Plus</item-name>
<item-description>Subscription to Escrow Coordinator Plus</item-description>
<unit-price currency="USD">0</unit-price>
<quantity>1</quantity>
</item>
</items>
</shopping-cart>
- <checkout-flow-support>
- <merchant-checkout-flow-support>
<edit-cart-url>[redacted]</edit-cart-url>
<continue-shopping-url>[redacted]/Transactions/3119988d-9ce4-43d2-b2a4-6f9bf1fe6a78</continue-shopping-url>
</merchant-checkout-flow-support>
</checkout-flow-support>
</checkout-shopping-cart>
I am trying to create a subscription in Google Checkout. The subscription is created but it charges at the end of the period not the beginning. I admit that I only waited a few hours to make sure it was going to charge, so if i just need to give it a while longer let me know.
I have tried to match the code exactly as seen here: http://code.google.com/apis/checkout/developer/Google_Checkout_Beta_Subscriptions.html#Google_Handled_Subscriptions
Has anyone ever been able to get this to charge at the beginning not the end?
I have the following code:
string digitalContent = "Congratulations! Your subscription is being set up. Feel free to log onto <a href='{0}'>{0}</a> and try it out!";
digitalContent = String.Format(digitalContent, String.Format(ConfigurationManager.AppSettings["ContinueShoppingUrl"], this.Transaction.ID));
CheckoutShoppingCartRequest Req = GCheckoutButton1.CreateRequest();
Req.ContinueShoppingUrl = String.Format(ConfigurationManager.AppSettings["ContinueShoppingUrl"], this.Transaction.ID);
Req.EditCartUrl = ConfigurationManager.AppSettings["EditCartUrl"];
SubscriptionPayment payment = new SubscriptionPayment();
payment.MaximumCharge = 0;
payment.Times = 12;
Subscription subscription = new Subscription();
subscription.Period = GCheckout.AutoGen.DatePeriod.MONTHLY;
subscription.Type = SubscriptionType.google;
subscription.StartDate = DateTime.Now;
subscription.NoChargeAfter = DateTime.Now.AddMonths(12);
ShoppingCartSubscriptionItem subscriptionItem = new ShoppingCartSubscriptionItem();
subscriptionItem.Price = 0;
subscriptionItem.Name = "Subscription to [redacted]";
subscriptionItem.Description = "Subscription to [redacted]";
subscriptionItem.Quantity = 1;
subscriptionItem.Subscription = subscription;
subscriptionItem.DigitalContent = new DigitalItem(digitalContent, false);
ShoppingCartSubscriptionItem subscriptionItem2 = new ShoppingCartSubscriptionItem();
subscriptionItem2.Name = "";
subscriptionItem2.Description = this.Transaction.ID.ToString();
subscriptionItem2.Quantity = 1;
payment.MaximumCharge = 15.00M;
subscriptionItem2.Price = 15.00M;
subscription.RecurrentItem = subscriptionItem2;
subscription.AddSubscriptionPayment(payment);
Req.AddItem(subscriptionItem);
GCheckoutResponse Resp = Req.Send();
Which generates the following xml:
<?xml version="1.0" encoding="utf-8" ?>
- <checkout-shopping-cart xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://checkout.google.com/schema/2">
- <shopping-cart>
- <items>
- <item>
- <subscription no-charge-after="2012-06-28T06:54:15.9492-07:00" period="MONTHLY" start-date="2011-06-28T06:54:15.9492-07:00" type="google">
- <payments>
- <subscription-payment times="12">
<maximum-charge currency="USD">15.00</maximum-charge>
</subscription-payment>
</payments>
- <recurrent-item>
<tax-table-selector />
<item-name />
<item-description>3119988d-9ce4-43d2-b2a4-6f9bf1fe6a78</item-description>
<unit-price currency="USD">15.00</unit-price>
<quantity>1</quantity>
</recurrent-item>
</subscription>
- <digital-content>
<description>Congratulations! Your subscription is being set up. Feel free to log onto <a href='[redacted]/Transactions/3119988d-9ce4-43d2-b2a4-6f9bf1fe6a78'>[redacted]/Transactions/3119988d-9ce4-43d2-b2a4-6f9bf1fe6a78</a> and try it out!</description>
<display-disposition>PESSIMISTIC</display-disposition>
</digital-content>
<tax-table-selector />
<item-name>Subscription to Escrow Coordinator Plus</item-name>
<item-description>Subscription to Escrow Coordinator Plus</item-description>
<unit-price currency="USD">0</unit-price>
<quantity>1</quantity>
</item>
</items>
</shopping-cart>
- <checkout-flow-support>
- <merchant-checkout-flow-support>
<edit-cart-url>[redacted]</edit-cart-url>
<continue-shopping-url>[redacted]/Transactions/3119988d-9ce4-43d2-b2a4-6f9bf1fe6a78</continue-shopping-url>
</merchant-checkout-flow-support>
</checkout-flow-support>
</checkout-shopping-cart>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
检查 google api 网站:http://code.google.com/apis/checkout /developer/Google_Checkout_Beta_Subscriptions.html
找到“通过订阅提交订单”部分。
我会尝试找到链接,但我读到要在开始时收费,您必须在购物车中有第二件商品。因此,现在对一项项目收费,然后在每个期间结束时对重复项目收费。它在 API 文档中
Check the google api site: http://code.google.com/apis/checkout/developer/Google_Checkout_Beta_Subscriptions.html
find the section for "Submitting an Order with a Subscription".
I will try to find the link, but i read that to charge at the beginning, you have to have a second item in the cart. So one item charges now, then recurring item at the end of each period. It was in the API docs