Joel
Joel

Reputation: 895

Refund + cancel subscription Paypal API

I hired someone to code me a bit of code that cancel a recurring payment in Paypal's API that goes like this:

function change_subscription_status( $profile_id, $action ) {

   $api_request = 'USER=' . urlencode( 'xxxxxxxxxxxxxxx' )
    .  '&PWD=' . urlencode( 'xxxxxxxxxxxxxxx' )
    .  '&SIGNATURE=' . urlencode( 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' )
    .  '&VERSION=76.0'
    .  '&METHOD=ManageRecurringPaymentsProfileStatus'
    .  '&PROFILEID=' . urlencode( $profile_id )
    .  '&ACTION=' . urlencode( $action )
    .  '&NOTE=' . urlencode( 'Plan cancelled in application' );


$ch = curl_init();
curl_setopt( $ch, CURLOPT_URL, 'https://api-3t.paypal.com/nvp' );

[...]

Is there a way with the Paypal API to ALSO REFUND an amount X.XX at the SAME time?

Basically, I want to cancel a recurring transaction of, say 10$ monthly and if the client used the software for 15 days, then give a 5$ refund.

Upvotes: 1

Views: 1770

Answers (1)

Drew Angell
Drew Angell

Reputation: 26056

Yes, you would just build a RefundTransaction request the same way you built the ManageRecurringPaymentsProfileStatus request and run them back to back in your script.

Upvotes: 2

Related Questions