Hi
I'm trying to test a couple of buy now buttons that I've configured using a php snippet, as pasted below.
This works when I use the shortcode for a subscription: [buy name="Monthly partnership" amount="450" months="2" currency="USD" paypal_title="Monthly retainer" ]
But I get the error when I use the single product shortcode: [buy name="3 months package" amount="1250" paypal_title="3 month confidence coaching package" ]
Any thoughts?
Steve
function cc_buy($atts){ extract( shortcode_atts( array( 'name' => '', 'price' => '', 'amount' => '', 'months' => '1', 'paypal_title' => 'Confidence coaching with Steve Errey', 'currency' => 'USD', 'button' => 'Buy now' ), $atts ) );
$output .= "<div class='buycoaching'>"; $output .= '<form name="_xclick" action="https://sandbox.paypal.com/cgi-bin/webscr" method="post">'; if ($months == 1){ $output .= '<input type="hidden" name="cmd" value="_xclick">'; $output .= '<input type="hidden" name="amount" value="'.$amount.'">'; } else { // It's a monthly subscription, not a one-off payment $output .= '<input type="hidden" name="cmd" value="_xclick-subscriptions">'; $output .= '<input type="hidden" name="a3" value="'.$amount.'">'; $output .= '<input type="hidden" name="p3" value="1">'; $output .= '<input type="hidden" name="t3" value="M">'; $output .= '<input type="hidden" name="src" value="1">';
} $output .= '<input type="hidden" name="business" value="[sandbox merchant account]">'; $output .= '<input type="hidden" name="currency_code" value="'.$currency.'">'; $output .= '<input type="hidden" name="item_name" value="'.$paypal_title.'">'; $output .= '<input type="submit" border="0" name="submit" value="'.$button.'" alt="Buy now" class="button">'; $output .= '</form>'; $output .= '</div>'; return $output; }
... View more