Question: I am currently using PayPal buttons in my application written in Scala (Play Framework).

Now I am trying to implement PayPal IPN instead of redirect. 
According to PayPal document

<https://developer.paypal.com/docs/classic/ipn/gs_IPN/>

After the user finished the payment, the flow of events is:

1. PayPal posts a message to my application's listener with all sorts of variables.
2. My listener returns an empty HTTP 200 response.
3. My listener performs an HTTP POST to send the complete, unaltered notification back to PayPal.
4. PayPal sends a single word back - either VERIFIED or INVALID.

So, my controller's method should look like:

```
  def payPalIpn() = Action { implicit request =>
    .... Get all PayPal Variables .......

    /* Send empty response with empty HTTP 200 response */
    Ok("")

    .... Make a POST request to PayPal site with all original PayPal's variables

  }

```

Here is what I stumbled upon - How can I make a POST request after I return OK("")?
Is that even possible in Play?

Appreciate if someone can give me any idea.

Andrei.

Answer: 
This would be an excellent use case for an Akka Actor:

```
def payPalIpn() = Action { implicit request =>
    .... Get all PayPal Variables .......

   actorSystem.actorSelection("paypal-ipn-actor") ! ValidateIPN(request.body)

    /* Send empty response with empty HTTP 200 response */
    Ok("")

  }

```
If I understand it correct, you want to make a POST request to PayPal in your action. For that you can use WS Client library from Play. Detailed tutorial is given at 
<https://www.playframework.com/documentation/2.4.x/ScalaWS>