2

Using the PayPal API, I want to send an invoice marked as paid via email, as soon as the buyer completes the purchase in the web application.

Is it possible?

Without using the API, you cannot send an email notification manually for paid invoices. Is that right?

Serdar
  • 305
  • 3
  • 12
  • I'm a little confused. Why wouldn't you just generate a typical email receipt for them and send that when they complete the sale? You want to create a new invoice, then mark it paid..?? That would be a completely separate "transaction". – Drew Angell Dec 05 '14 at 16:08
  • The thing is, my director wants invoices to be viewed, printed and managed through PayPal invoices section. – Serdar Dec 08 '14 at 06:34

3 Answers3

0

In your checkout system, when the order comes through, make a call to the CreateInvoice API. This will generate the invoice in the PayPal system. You can use the "number" parameter in the CreateInvoice request to pass your regular order ID if you have one so that the invoices are nicely related to your checkout order.

Then, immediately after that call, make a call to MarkInvoiceAsPaid. This will mark the invoice as paid in the PayPal system so that you have a nice record of it there.

Sounds like what you're after, right?

If you happen to be working with PHP, my class library for PayPal will make all of the invoicing API calls very simple for you.

Drew Angell
  • 25,968
  • 5
  • 32
  • 51
  • At first I thought this would work great, but I'm using the REST API and actually tried it. The equivalent of MarkInvoiceAsPaid() is recordPayment() in the REST API and you cannot mark an invoice as paid just after creating it, without sending it. It gives you the following error: "Cannot pay a draft entity." – Serdar Dec 08 '14 at 14:41
0

You need to do 3 things:

  • CreateInvoice

  • SendInvoice (then customer receives invoice via e-mail, but he still button "Pay now").

  • When he pays you directly, you send MarkInvoiceAsPaid. That removes the "Pay now" and adds message that the invoice is marked as paid on the given date.

-1

You need to make 3 API calls here:

  1. Create an invoice
  2. Send invoice
  3. Record payment

When you create an invoice, it is created in DRAFT state and it is actually not a legitimate invoice. So, when merchant send this invoice the state of the invoice changes to SENT state and it becomes legitimate. To mark it as paid, you need to call record payment API and pass the payment method in request body as CASH, CREDIT_CARD, DEBIT_CARD, PAYPAL, WIRE_TRANSFER or, OTHER. The API documentation on PayPal developer site is pretty much informative. I hope this answers your question.

Sumved Shami
  • 102
  • 2
  • 15
  • If you send an invoice (for an already paid item), the buyer will get an email with a button to pay the invoice. I guess it is not possible to make this API call without sending an email. Because this is the purpose of this method anyway, _sending_ an invoice. So your suggestion will confuse buyers. – Serdar Jan 14 '15 at 15:46
  • the buyer will receive an email with a "pay here" button. Bad user experience. Very confusing. – Gianluca Ghettini Nov 09 '15 at 12:12
  • Hi Gianluca/Serdar Yes! I agree that this is a bad user experience. But, that's the only way for the above query. At least till the time I replied the query. A user also gets the email when the invoice is marked as paid. And, when user tries to click on the Pay button, he will get an error saying that the amount is already paid. – Sumved Shami Nov 10 '15 at 14:52