Affiliate referrals can not creat automatically when a client makes a payment by paypal

Dear Sir,

Thanks for your give us plugin of Paypal . We modify the codes according to Afiliate Pro with Paypal Interation.

Our Website is using Bookly to Book on line by Paypal. The plugin is

WordPress Online Booking and Scheduling Plugin – Bookly

According to Afiliate Pro with Paypal Plugin, Set the Return URL
https://sydney.qingscleaning.com/booking_thank-you-for-your-payment_786_20190629.html
Set the Cancel URL
https://sydney.qingscleaning.com/booking_the-payment-has-been-cancelled_788_20190629.html

And according to introduction , We Modify the Bookly API Code.

But Affiliate referrals can not creat automatically when a client makes a payment.

The New Bookly API Code is following , Can you help me to find the problem?

load();

$cart_info = $userData->cart->getInfo( Payment::TYPE_PAYPAL );
$cart_info->setGatewayTaxCalculationRule( ‘tax_increases_the_cost’ );
$first_name = $userData->getFirstName();
$last_name = $userData->getLastName();
// Check if defined First name
if ( ! $first_name ) {
$full_name = $userData->getFullName();
$first_name = strtok( $full_name, ‘ ‘ );
$last_name = strtok( ” );
}
$replacement = array(
‘%action%’ => ‘https://www’ . ( get_option( ‘bookly_paypal_sandbox’ ) ? ‘.sandbox’ : ” ) . ‘.paypal.com/cgi-bin/webscr’,
‘%business%’ => get_option( ‘bookly_paypal_id’ ),
‘%amount%’ => $cart_info->getGatewayAmount(),
‘%tax%’ => $cart_info->getGatewayTax(),
‘%currency%’ => get_option( ‘bookly_pmt_currency’ ),
‘%item_name%’ => esc_attr( $userData->cart->getItemsTitle( 127 ) ),
‘%notify_url%’ => esc_attr( add_query_arg( array( ‘bookly_action’ => ‘paypal-ps-ipn’ ), $page_url ) ),
‘%return%’ => esc_attr( add_query_arg( array( ‘bookly_action’ => ‘paypal-ps-return’, ‘bookly_fid’ => $form_id ), $page_url ) ),
‘%cancel_return%’ => esc_attr( add_query_arg( array( ‘bookly_action’ => ‘paypal-ps-cancel’, ‘bookly_fid’ => $form_id ), $page_url ) ),
‘%email%’ => $userData->getEmail(),
‘%first_name%’ => esc_attr( $first_name ),
‘%last_name%’ => esc_attr( $last_name ),
‘%back%’ => Common::getTranslatedOption( ‘bookly_l10n_button_back’ ),
‘%next%’ => Common::getTranslatedOption( ‘bookly_l10n_step_payment_button_next’ ),
‘%gateway%’ => Payment::TYPE_PAYPAL,
‘%align_class%’ => get_option( ‘bookly_app_align_buttons_left’ ) ? ‘bookly-left’ : ‘bookly-right’,
);
$form = ‘

<input type=”hidden” name=”custom” value=”” class=”bookly-payment-id” />

<input type=”hidden” name=”notify_url” value=”” />

%back%

%next%

‘;

echo strtr( $form, $replacement );
}
}

Hope to get your reply as soon as possible.

Your
Jacky Zhang

Posted in
Tags

Comments

One response to “Affiliate referrals can not creat automatically when a client makes a payment by paypal”

  1. George Avatar

    Hi Jacky,

    Thanks for installing and using our plugins.

    Since there is no integration for Bookly plugin, the best and easiest way to integrate would be to find the hook when a booking is added and then add a referral as demonstrated in the example on this page:
    http://docs.itthinx.com/document/affiliates-pro/api/referrals/

    If Bookly provides PayPal as payment gateway already, then I think it would be better to keep Affiliates Paypal deactivated and add the referral once the Bookly marks the payment as complete.

    Kind regards,
    George

Share