Reputation: 535
I have a Japan Plus account, I am just surprised that subscribe doesn't works with iframe (templateD)
I did it like this:
subscribe
hosted button with BMCreateButton api (including templateD as params)in a frame because it set 'X-Frame-Options' to 'SAMEORIGIN'.
.
<iframe name="hss_iframe" width="570px" height="540px"></iframe>
<form name="form_iframe" target="hss_iframe" action="https://securepayments.paypal.com/cgi-bin/acquiringweb" method="post">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="encrypted" value="BEGIN PKCS7......END PKCS7">
<input type="image" src="https://www.paypal.com/en_US/i/btn/btn_auto_billing_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online.">
<img alt="" border="0" src="https://www.paypal.com/en_GB/i/scr/pixel.gif" width="1" height="1">
</form>
<script type="text/javascript">
document.form_iframe.submit();
</script>
I have tried other button types like Payment
, and it do works well, so my question is:
Does paypal support subscribe payments in iframe? (am I doing something wrong?)
If doesn't support it, what's the most seamless way to do this?
Upvotes: 0
Views: 608
Reputation: 816
you cannot create a recurring profile through the Hosted Payments endpoint by passing "Payments Standards" variables.
The PayPal system will automatically do a 302 redirect to the webscr endpoint (if the browser were to load the page outside of the iframe, with X-Frame-Options set, it refuses to load at all).
You cannot create recurring payments profiles through HSS (hosted sole solution). This product will merely take credit card payments from your site.
Please refer to https://www.paypalobjects.com/webstatic/en_JP/developer/docs/pdf/paymentsplus.pdf for supported integration steps.
======
--> either use Subscription "Buttons" - it looks like you've already tied into the Button Manager API enough to programmatically create them. Just make sure you're actually submitting the data to the paypal.com/cgi-bin/webscr endpoint.
Furthermore, the more "flexible" (in terms of customizability) approach is to utilize Express Checkout - recurring payments.
You basically do a SetExpressCheckout Call, get a token, then redirect the buyer to PayPal to authorize the Recurring Payment. The buyer is sent back to your page and you can then use the CreateRecurringPaymentsProfile Call and pass the authorized EC token to create the Recurring Profile.
For more info, I'd suggest having a look at https://developer.paypal.com/webapps/developer/docs/classic/express-checkout/integration-guide/ECRecurringPayments/
Upvotes: 1