Enthusiast
Enthusiast

Reputation: 831

Paypal Invoice Response

I want to implement Paypal Invoice to send invoices to customers in their emails. I have seenn PHP sdk of paypal for this. Once I implement this, the code will send emails to users with invoice that customers will pay.

Now my question is when customer pay via invoice their email, can my web application get a response of successful payment? Actually I want in my application when existing period of a user expires, I want to send an invoice to user to renew its registration via email. But I want when user made a payment, my application must be know about successful payment so that I can renew user registration. Is it possible if yes then how?

Upvotes: 0

Views: 252

Answers (1)

Drew Angell
Drew Angell

Reputation: 26036

You'll need to setup an IPN listener to get all this working smoothly for you. Once you do that, though, it'll work very well. I've done this sort of thing a bunch of times.

Make sure to include your own record ID / invoice ID in the CreateAndSendInvoice request that you're doing. It would be in the invoiceNumber element in your XML request. More details on that here.

Then, when the invoice is paid, you'll get an immediate IPN notification sent to your listener with a txn_type of invoice_payment. It will also include an invoice_number parameter that matches what you sent in the CASI request. This allows you to hit your data to pull data back out or update your own records accordingly based on the IPN data.

Consider this sort of thing, too. If the person pays the invoice in a way that becomes an e-check, you'll get an IPN with a payment_status = pending. Of course, you wouldn't want to fulfill the order at that point, but you could have the IPN listener send out email notifications about the pending payment, and let the customer know as soon as it clears they'll get another notification.

When the payment clears, you would get another IPN with the same transaction ID and everything, but an updated payment_status. So this allows you to completely automate all of that, and it happens in real time. It's quite lovely.

Upvotes: 2

Related Questions