title: Using the PayPal REST API, how can I cancel a payment?
body: <p>Using the PayPal REST API, I cannot seem to figure out how to cancel a payment after a client clicks the "Cancel order and return to website" link. Perhaps in production mode PayPal cancels these payments automatically, but in sandbox mode they seem to stay in the "created" state.</p>
  
  <p>That observation lead me to believe that I need to programmatically cancel each payment upon return to the website's "cancel_url" page. However, I cannot seem to find a cancel function in the PayPal REST API documentation.</p>
  
  <p><a href="https://developer.paypal.com/docs/api/" rel="noreferrer">https://developer.paypal.com/docs/api/</a></p>
  
  <p>For what it's worth, I'm using the Ruby API.</p>