make sure that you use the transaction id when the amount was 'capture'. in my app, i use authorize/capture/refund API. the transaction id when i 'authorize' is different from the transaction id when i 'capture'
here's the data i got when i capture the amount.
timestamp: '2014-01-30T21:59:33Z'
ack: Success
correlation_id: 7803f5d114c45
version: '72'
build: '9285531'
authorization_id: 04G82796YE043610H
transaction_id: 9A656277C6136044L
parent_transaction_id: 04G82796YE043610H
receipt_id:
transaction_type: express-checkout
payment_type: instant
payment_date: '2014-01-30T21:59:32Z'
gross_amount: '15.97'
gross_amount_currency_id: USD
fee_amount: '0.76'
fee_amount_currency_id: USD
tax_amount: '0.00'
tax_amount_currency_id: USD
exchange_rate:
payment_status: Completed
pending_reason: none
reason_code: none
protection_eligibility: Eligible
protection_eligibility_type: ItemNotReceivedEligible,UnauthorizedPaymentEligible
AuthorizationID: 04G82796YE043610H
PaymentInfo:
TransactionID: 9A656277C6136044L
ParentTransactionID: 04G82796YE043610H
ReceiptID:
TransactionType: express-checkout
PaymentType: instant
PaymentDate: '2014-01-30T21:59:32Z'
GrossAmount: '15.97'
FeeAmount: '0.76'
TaxAmount: '0.00'
ExchangeRate:
PaymentStatus: Completed
PendingReason: none
ReasonCode: none
ProtectionEligibility: Eligible
ProtectionEligibilityType: ItemNotReceivedEligible,UnauthorizedPaymentEligible
then i call the refund method:
Gateway.refund(798,'9A656277C6136044L')
=> #<ActiveMerchant::Billing::PaypalExpressResponse:0x007ff4e744b450
@authorization="70L01419MK614945K",
@avs_result=
{"code"=>nil, "message"=>nil, "street_match"=>nil, "postal_match"=>nil},
@cvv_result={"code"=>nil, "message"=>nil},
@fraud_review=false,
@message="Success",
@params=
{"timestamp"=>"2014-01-31T01:56:47Z",
"ack"=>"Success",
"correlation_id"=>"55810b5eb3c3d",
"version"=>"72",
"build"=>"9285531",
"refund_transaction_id"=>"70L01419MK614945K",
"net_refund_amount"=>"7.75",
"net_refund_amount_currency_id"=>"USD",
"fee_refund_amount"=>"0.23",
"fee_refund_amount_currency_id"=>"USD",
"gross_refund_amount"=>"7.98",
"gross_refund_amount_currency_id"=>"USD",
"total_refunded_amount"=>"7.98",
"total_refunded_amount_currency_id"=>"USD",
"Timestamp"=>"2014-01-31T01:56:47Z",
"Ack"=>"Success",
"CorrelationID"=>"55810b5eb3c3d",
"Version"=>"72",
"Build"=>"9285531",
"RefundTransactionID"=>"70L01419MK614945K",
"NetRefundAmount"=>"7.75",
"FeeRefundAmount"=>"0.23",
"GrossRefundAmount"=>"7.98",
"TotalRefundedAmount"=>"7.98"},
@success=true,
@test=true>
hth