Forums

Paypal API code to submit amount value

donna22 27 May, 2011
Hi guys,

I'm planning to buy a subscription after this worked.

I've tried to use the code in 'Paid registration using Paypal plugin' tutorial, and it works. But this is not my form requires.

I only need to submit the amount value using Paypal API and not with paid registration.

Can you help me on this guys? Please guide me. What would be the code for this?

Here is my form:




Thank you.
donna22 27 May, 2011
How to modify this code that is given from the tutorial so that it only submit the amount and not with the registration?

Here's the code from the tutorial:
<?php
$MyPlugins =& CFPlugins::getInstance($MyForm->formrow->id);
if(!$MyPlugins->cf_joomla_registration['errors']){
  $MyPlugins->runPlugin('after_email', array('ONSUBMIT', 'ONLOADONSUBMIT'), 'cf_paypal_api');
  if($MyPlugins->cf_paypal_api['payment_status'] == 'SUCCESS'){
    echo  "Thank you for registering at Mysite.com. You will be recieving a confirmation email shortly";
    $MyFormEmails =& CFEMails::getInstance($MyForm->formrow->id);
    $MyFormEmails->setEmailData(1, 'enabled', '1');
    $MyFormEmails->sendEmails($MyForm, $MyFormEmails->emails);
  }else{
    $regUser = new JUser($MyPlugins->cf_joomla_registration['user']->id);
    $regUser->delete();
    $MyForm->addErrorMsg( 'An error occured : '.$MyPlugins->cf_paypal_api['error_message'] );
    $MyForm->haltFunction["autogenerated_after_email"] = true;
  }
}else{
  $MyForm->addErrorMsg($MyPlugins->cf_joomla_registration['errors']);
  $MyForm->haltFunction["autogenerated_after_email"] = true;
}
?>
 
GreyHead 27 May, 2011
Hi donna22,

I'm not sure, I've never used the PayPal API plug-in - here's my best guess:
<?php
$MyPlugins =& CFPlugins::getInstance($MyForm->formrow->id);
$MyPlugins->runPlugin('after_email', array('ONSUBMIT', 'ONLOADONSUBMIT'), 'cf_paypal_api');
if($MyPlugins->cf_paypal_api['payment_status'] == 'SUCCESS'){
  echo  "Thank you for XXXXX at Mysite.com. You will be recieving a confirmation email shortly";
  $MyFormEmails =& CFEMails::getInstance($MyForm->formrow->id);
  $MyFormEmails->setEmailData(1, 'enabled', '1');
  $MyFormEmails->sendEmails($MyForm, $MyFormEmails->emails);
} else {
  $MyForm->addErrorMsg( 'An error occured : '.$MyPlugins->cf_paypal_api['error_message'] );
  $MyForm->haltFunction["autogenerated_after_email"] = true;
}
?>
I've just taken out the 'registration' lines.

Bob
GreyHead 27 May, 2011
Hi donna22,

I've just replied to your other post on this.

Bob
donna22 30 May, 2011
Hi GreyHead,

Thank you for the code!

I'm just wondering why is it in my Sandbox Paypal, when i use a buyer account and purchase, it doesn't deducted in my sandbox account?

I would like t purchase of your subscription.

Great Help! Thanks!
GreyHead 30 May, 2011
Hi donna32,

I've used the Sandbox successfully with the ReDirect Plug-in and with a PayPal IPN plug-in of my own (but not with the API plug-in). It always seems to be a bit fiddly getting all the settings correct for payments to show up :-(

Bob
donna22 30 May, 2011
Hi GreyHead,

I really appreciate your help. I just bought a license.

And I really need the Paypal API to get work, this is the only reason why I'd buy the product, I hope you could help me on this.

I've already emailed Max through the Contact Us form.


And in my form, I have used the code that you've shared to me from my previous post topic.

I would love to use the ReDirect paypal but I need the Direct Payment within my website.

Please help.


Thank you.
donna22 30 May, 2011
Hi GreyHead,

I've validated my license already, and I have emailed Max also for the patch.. but he did not reply on me yet.

Is there any way that I could get my form submit exact amount into paypal.


Thank you so much.
GreyHead 30 May, 2011
Hi donna22,

You need the patch from Max to get the correct amount I'm afraid; I don't have it.

Bob
donna22 31 May, 2011
Hi GreyHead,

Thanks so much for great advices.

I am using the patch now. But I have a problem.

I have to two forms: FormA and FormB.

After the form submission, when I check in my Paypal Sandbox, it doesn't deducted from the correct total amount.

For:
FormA = $ 2.21 (deducted amount from the original value)
FormB = $ 2.04 (deducted amount from the original value)


First, why it doesn't submit the correct amount?
Second, why it deducted different amount from the the two different form?(FormA & FormB)
Finally, How to fix this?

Thanks in advance.
GreyHead 31 May, 2011
Hi donna22,

What do you mean by 'deducted'? Is this some calculation in your code? I don't think that the Plug-in makes any deductions (other than the random amount in the unlicensed version).

Please give me some more information about what is happening here.

Bob
donna22 08 Jun, 2011
Hi GreyHead,

I've just known that paypal also deduct a certain amount upon the successful transactions. I am now in 'how to secure' my forms. Any idea how to do this?

Thanks!
GreyHead 08 Jun, 2011
Hi donna,

PayPal charges a transaction fee that you can see in your PayPal account statements. ChronoForms has no affect on that at all.

I think that the fee may be in the data that you can get returned from PayPal in the API.

Bob
This topic is locked and no more replies can be posted.