PDA

View Full Version : GoogleCheckout form start-date (need 14 days into future)



nycguurl
04-16-2013, 10:49 PM
What I'm trying to accomplish is not to start the first payment on a subscription until 14 days after they process.
This is for a free trial. How do I format the start-date to be 14 days into the future.
I have read for hours and hours... and hours. Please help.
It's on the 8th line at the end.
I know it's possible but I just don't know how to format it.




<form method="POST" action="https://checkout.google.com/api/checkout/v2/checkoutForm/Merchant/123456789" accept-charset="utf-8">
<input type="hidden" name="shopping-cart.items.item-1.item-name" value="5lbs Baked Goods"/>
<input type="hidden" name="shopping-cart.items.item-1.item-description" value="TBD"/>
<input type="hidden" name="shopping-cart.items.item-1.unit-price.currency" value="USD"/>
<input type="hidden" name="shopping-cart.items.item-1.unit-price" value="30.00"/>
<input type="hidden" name="shopping-cart.items.item-1.quantity" value="1"/>
<input type="hidden" name="shopping-cart.items.item-1.subscription.type" value="google"/>
<input type="hidden" name="shopping-cart.items.item-1.subscription.period" value="MONTHLY" start-date="2012-04-01T07:55:55.952-08:00">
<input type="hidden" name="shopping-cart.items.item-1.subscription.payments.subscription-payment-1.times" value="12">
<input type="hidden" name="shopping-cart.items.item-1.subscription.payments.subscription-payment-1.maximum-charge" value="30.00">
<input type="hidden" name="shopping-cart.items.item-1.subscription.payments.subscription-payment-1.maximum-charge.currency" value="USD">
<input type="hidden" name="shopping-cart.items.item-1.subscription.recurrent-item.item-name" value="Recurring Baked Goods">
<input type="hidden" name="shopping-cart.items.item-1.subscription.recurrent-item.item-description" value="Item Description TBD">
<input type="hidden" name="shopping-cart.items.item-1.subscription.recurrent-item.quantity" value="1">
<input type="hidden" name="shopping-cart.items.item-1.subscription.recurrent-item.unit-price" value="0">
<input type="hidden" name="shopping-cart.items.item-1.subscription.recurrent-item.unit-price.currency" value="USD">
<input type="hidden" name="shopping-cart.items.item-1.subscription.recurrent-item.digital-content.display-disposition" value="OPTIMISTIC">
<input type="hidden" name="shopping-cart.items.item-1.digital-content.display-disposition" value="OPTIMISTIC">
<input type="hidden" name="shopping-cart.items.item-1.subscription.recurrent-item.digital-content.url" value="http://mywebsite.com">
<input type="hidden" name="shopping-cart.items.item-1.subscription.recurrent-item.digital-content.description" value="Filler text">
<input type="hidden" name="shopping-cart.items.item-1.digital-content.description" value="Thank you!">
<input type="hidden" name="_charset_"/>
<input type="image" name="Google Checkout" alt="" src="http://checkout.google.com/buttons/checkout.gif?merchant_id=123456789&w=180&h=46&style=white&variant=text&loc=en_US" height="46" width="180"/>
</form>

Beverleyh
04-17-2013, 05:32 AM
I've never used Google checkout but for a 'normal' form there would be 2 ways to tackle it.

The first is to manipulate the start date during form generation/page load. I don't know how the form is generated though or how the start date is being inserted into the form markup. Is the form html hard coded on the page by you and does the form use php or some other server side language to echo the current date into the start date attribute? If so, you could add 14 days to the current date and then echo the revised date into the form. Here are some examples of adding days to the current date: http://stackoverflow.com/questions/277247/increase-days-to-php-current-date and http://stackoverflow.com/questions/5174789/php-add-7-days-to-date-format-mm-dd-yyyy
This idea could cause skewed results though because in theory a person could have the form open for a few days before submitting it which would cause the initially loaded start date to be 'out'. Its unlikely that anyone would have a page open that long but it might cause problems if somebody was completing a longer form past midnight. That's why it's better to process the date from the time of form submission and do it via the server. Which leads to option two...

The second way would be to manipulate the start date on form submission. I think this would be harder as you'd need access to the processing scripts, which I don't think is possible as this is handled by a 3rd party.

I think the first option sounds more plausible but it depends how much control you have over the form and if you can envisage too many problems with a potential time difference between page load and form submission. Like I said, I've never used Google checkout.

nycguurl
05-07-2013, 06:11 AM
Hi Beverley, I forgot to come back and say thank you.