Using PayPal with A2Billing

A2Billing comes with PayPal integration built in so that A2Billing customers can add credit to their balance using PayPal automatically.

There are a few things to configure to get this integration working, which are listed below.

The exact setup will depend if you are running A2Billing 1.3 or A2Billing 1.4+. In version 1.3 all of the settings were in a file called /etc/asterisk/a2billing.conf. In versions 1.4 and later the settings were moved in to the database and can be changed via the web GUI. The examples here show the web GUI.

Payments work in 5 steps. These are –

  1. In A2Billing customer clicks to make a payment and is redirected to the PayPal website
  2. Customer makes a payment on the PayPal website
  3. Payment notification is queued by PayPal using IPN
  4. PayPal IPN connects to your A2Billing webserver and passes the transaction details. This could happen a little while after the payment
  5. Transaction is recorded in A2illing and balance updated

In A2BILLING

The first thing to do is switch on PayPal and set your PayPal payment e-mail address.

Under BILLING select Payment Methods –

Enable PayPal and enter your payment address –

Now select SYSTEM SETTINGS and Global List –

Now select epayment_method and click search –

Enable the e-payment settings –

Set the HTTP URL to blank and the HTTPS url to the url of your A2Billing server (you really should be using HTTPS). This can either be a domain name or an IP address –

Set the url on the web server for the customer interface. The customer interface on my A2Billing server is just ‘/’ –

Enable SSL  (the http_domain setting is probably not needed) –

Set the purchase amounts and currency for the purchases. The purchases amounts are the options the customer will see in the customer interface –

Set the PayPal call URLs. Pay close attention to these. They changed a while back  (and could be changed by PayPal again) –

IN PAYPAL

Select Profile then Instant Payment Notification preferences –

Ensure that IPN is enabled and enter a Notification URL. This URL you enter is unimportant as the actual URL called will be passed to PayPal based on your A2Billing settings –

And that should be it. You should be good to go.

TROUBLESHOOTING

If you run in to problems there are a few simple things to check

  • Ensure that you have port 443 open and that your webserver is listening on HTTPS on your A2Billing server as PayPal will be making calls to it
  • Ensure the A2Billing settings above are correct, especially the PayPal URL settings
  • Check your webserver logs to see if you can see PayPal making a call to your A2Billing server after the payment

Check your PayPal IPN History. A link to this can be found on the IPN setup page. This should tell you what URL PayPal is trying to notify about the payment –

19 thoughts on “Using PayPal with A2Billing

  1. Joe

    Does this automatically draft funds from the users paypal account? Or does the user have to click to pay each time via an email notification. I’m weighing the difference of a regular merchant account vs. paypal.

  2. Vashkar

    how do I add the paypal transaction fees with customers balance as paypal returns the amount after deducting the service charges (2.7%+.3)?

  3. matt Post author

    I think the setting you want is under settings/global/epayment_method/charge_paypal_fee

    Cheers, Matt

  4. Mohamed

    Hi,
    Which file to choose from /a2billing/customer/….php to entre the IPN URL ??
    Thanks.

  5. matt Post author

    I don’t think you should need to set anything in there. A2Billing should be passing the return call address to PayPal when the payment request is made.

  6. Mohamed

    Ok, But how can PayPal make request for my A2billing server after transaction?
    for me, after the transaction was made the website will be redirected from sandbox to /a2billing/customer/userinfo.php however it should be redirected to /a2billing/customer/checkout_prcess.php
    Can you help me please?
    Yours

  7. sIava

    if IPN url is unimportant or wrong, how it can pass transaction to web server properly than? sysadmin, you said it must be set @4th step, wright?

  8. Carlos

    Hello, pls I need some hepl with payments with Paypal. When customer make a payments by Paypal the amount go directly to the customer account? Or I have to make some process to charge the account? Thanks. Carlos

  9. Matt Newcombe Post author

    Hi Carlos. If you have everything set up correctly then the payment should automatically get credited to the customers account.

  10. Carlos

    Hi Matt, thank you very much for your answer, it seems I have everything set up properly but the manoy not credited to the customer’s account. I see the payments in E-payment Log, the status is always new. What do You think that I need to configure to fix this . Thank you, Carlos

  11. Matt Newcombe Post author

    I would check in your webserver logs. You should see a request coming from PayPal to your server to add the credit.

  12. Carlos

    Thanks soo much Matt, copy the log becuase I don´t see any mistake, coul you help me pleas.
    [24/06/2014 14:00:38]:[checkout_process.php line:38EPAYMENT : transactionID=3 – transactionKey=77a3948bfad6155f876d596a4593
    -POST Var
    Array
    (
    [mc_gross] => 20.00
    [protection_eligibility] => Ineligible
    [payer_id] => DSY8NDB5JU
    [tax] => 0.00
    [payment_date] => 10:00:24 Jun 24, 2014 PDT
    [payment_status] => Completed
    [charset] => windows-1252
    [first_name] => Jose
    [mc_fee] => 1.08
    [notify_version] => 3.8
    [custom] =>
    [payer_status] => unverified
    [business] => [email protected]
    [quantity] => 1
    [verify_sign] => Asz-VR6gq4.PZCPEQJPOaS01-yQo-dMu.NCOiyCaCbv4StIv
    [payer_email] => jpn
    [txn_id] => 60W7773iscio1FR6250808
    [payment_type] => instant
    [payer_business_name] => Westcntina S.A.
    [last_name] => Piscione
    [receiver_email] => sale
    [payment_fee] => 1.08
    [receiver_id] => 9CZKQJ2N
    [txn_type] => web_accept
    [item_name] => Ce
    [mc_currency] => USD
    [item_number] =>
    [residence_country] => AR
    [handling_amount] => 0.00
    [transaction_subject] =>
    [payment_gross] => 20.00
    [shipping] => 0.00
    [ipn_track_id] => b0e26c
    )
    ]

    [24/06/2014 14:00:38]:[checkout_process.php line:41-transactionID=3 Wrong transactionID/sess_id/mb_amount]

  13. Matt Newcombe Post author

    I’ve not seen this before. If the PayPal update is coming in it should be updating the balance.

    Is this the latest version of A2Billing?

  14. watoan

    Hello, I have configured the Paypal payment accordingly, in the agi-conf, I already put HKD as currency_code, but when I try to buy credit, it is showing USD in Paypal transaction page, anything I did wrongly or any settings need to be done on my Paypal account? Please kindly help on this, thanks.

Comments are closed.