Skip to content

Instantly share code, notes, and snippets.

@dangrossman
Created August 17, 2012 05:29
Show Gist options
  • Save dangrossman/3376197 to your computer and use it in GitHub Desktop.
Save dangrossman/3376197 to your computer and use it in GitHub Desktop.
spreedly core problem
The form:
<form action="https://spreedlycore.com/v1/payment_methods" method="POST">
<input name="redirect_url" type="hidden" value="http://demo.improvely/plan" />
<input name="api_login" type="hidden" value="CK7U2rfiM3UqEARqw2jdDjgSmsR" />
<input type="hidden" name="data[plan]" value="Small Business" />
<input type="hidden" name="data[subdomain]" value="demo" />
<input name="payment_method_token" type="hidden" value="4HcPdjwaAr1VJZnztN7aMoG15cI" />
<input name="credit_card[first_name]" type="hidden" value="Joe" />
<input name="credit_card[last_name]" type="hidden" value="Smith" />
<input name="credit_card[email]" type="hidden" value="dan@dangrossman.info" />
<input type="text" class="input-large" name="credit_card[number]" value="XXXX-XXXX-XXXX-1111"/>
<select name="credit_card[month]" style="width: 120px">
<option value="1">1 - January</option>
<option value="2" selected="selected">2 - February</option>
<option value="3">3 - March</option>
<option value="4">4 - April</option>
<option value="5">5 - May</option>
<option value="6">6 - June</option>
<option value="7">7 - July</option>
<option value="8">8 - August</option>
<option value="9">9 - September</option>
<option value="10">10 - October</option>
<option value="11">11 - November</option>
<option value="12">12 - December</option>
</select>
<select name="credit_card[year]" style="width: 80px">
<option value="2012">2012</option>
<option value="2013">2013</option>
<option value="2014" selected="selected">2014</option>
<option value="2015">2015</option>
<option value="2016">2016</option>
<option value="2017">2017</option>
<option value="2018">2018</option>
<option value="2019">2019</option>
<option value="2020">2020</option>
<option value="2021">2021</option>
<option value="2022">2022</option>
<option value="2023">2023</option>
<option value="2024">2024</option>
</select>
<input type="text" class="input-small" name="credit_card[zip]" value="18974" />
<input type="text" class="input-mini" name="credit_card[verification_value]" value="XXX" />
<input type="submit" class="btn btn-success" value="Save Changes" />
</form>
--
I am redirected back to ?token=PEamin5o0gDiGuK6ev2ZNuasNip
Attempt to retain this new token:
<transaction>
<token>ZO32qQY7l2IreuT9oQykxfnhdGG</token>
<created_at type="datetime">2012-08-17T05:14:44Z</created_at>
<updated_at type="datetime">2012-08-17T05:14:44Z</updated_at>
<succeeded type="boolean">false</succeeded>
<transaction_type>RetainPaymentMethod</transaction_type>
<message key="messages.payment_method_invalid">The payment method is invalid.</message>
<payment_method>
<token>PEamin5o0gDiGuK6ev2ZNuasNip</token>
<created_at type="datetime">2012-08-17T05:13:25Z</created_at>
<updated_at type="datetime">2012-08-17T05:13:25Z</updated_at>
<last_four_digits>1111</last_four_digits>
<card_type nil="true"></card_type>
<first_name>Joe</first_name>
<last_name>Smith</last_name>
<month type="integer">2</month>
<year type="integer">2014</year>
<email>dan@dangrossman.info</email>
<address1 nil="true"></address1>
<address2 nil="true"></address2>
<city nil="true"></city>
<state nil="true"></state>
<zip>18974</zip>
<country nil="true"></country>
<phone_number nil="true"></phone_number>
<data>
<plan>Small Business</plan>
<subdomain>demo</subdomain>
</data>
<payment_method_type>CreditCard</payment_method_type>
<verification_value>XXX</verification_value>
<number>XXXX-XXXX-XXXX-1111</number>
<errors>
<error attribute="base" key="errors.basis_cannot_be_retained">Unable to base a payment method on another payment which has been retained.</error>
<error attribute="card_type" key="errors.blank">Card type can't be blank</error>
<error attribute="number" key="errors.invalid">Number is invalid</error>
</errors>
</payment_method>
</transaction>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment