Custom Payment on Advert (Final Value Fee)
I'm after some advice... The pricing model I'm going to use for Classipress is free listings with a Final Value fee to obtain contact details for the buyer.
To keep this thread simple, the work has been done to make Classipress work this way, by integrating a moderated user messaging plugin.
We will know when an offer is made and can offer that the seller pays the Final Value Fee to obtain contact details of the buyer.
I need to utilise the Payments API to create a payment against the advert. I've found the code in step 3 and propose to use it on a custom payment page, modifying it:
$order = appthemes_new_order();
$order->add_item( CP_FINAL_VALUE_FEE, $final_value_fee, $post_id ); // Add CP_FINAL_VALUE_FEE to add_theme_support 'app-payments'
do_action( 'appthemes_create_order', $order );
echo html( 'h3', __( 'Payment', APP_TD ) );
echo html( 'p', __( 'Please wait while we redirect you to our payment page.', APP_TD ) );
echo html( 'p', html( 'small', __( '(Click the button below if you are not automatically redirected within 5 seconds.)', APP_TD ) ) );
cp_js_redirect( "Custom thank you Page URL", __( 'Continue to Payment', APP_TD ) );
I'd also have to add support to payments.php with accompanying code to update a custom field Final_Value_Fee_Paid
add_action( 'appthemes_transaction_completed', 'cp_payments_handle_finalvaluefee_completed' );
add_action( 'appthemes_transaction_activated', 'cp_payments_handle_finalvaluefee_activated' );
Am I heading in the right direction? I don't want to start until I'm sure I won't cause problems anywhere else or have missed something.
Many thanks
John