谷歌结账订阅出现问题
本文关键字:问题 谷歌 | 更新日期: 2023-09-27 18:00:31
我正在尝试在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>
查看谷歌api网站:http://code.google.com/apis/checkout/developer/Google_Checkout_Beta_Subscriptions.html请参阅"提交带有订阅的订单"部分。我会尝试找到链接,但我在一开始就读到了要收费,你必须在购物车中有第二个项目。所以一个项目现在收费,然后在每个周期结束时重复项目。它在API文档中