Skip to content
This repository has been archived by the owner on Nov 18, 2021. It is now read-only.

Do Reference Transaction

drewjoh edited this page Apr 13, 2011 · 1 revision

Example: Charge a person based on a past PayPal transaction that has occurred.

You may need special permission from PayPal to use this method.

$paypal = new Paypal();
			
// Setup PayPal information
$paypal->payment_type  = 'Sale';
$paypal->first_name    = 'First Name';
$paypal->last_name     = 'Last Name';
$paypal->amount_total  = '42.00';

// A Transaction ID of a past payment the user has made
$paypal->reference_id = $last_paypal_transaction_id;

// Do the Reference Transaction (will be processed similar to a Direct Payment)
$paypal->do_reference_transaction();

NOTE: PayPal states that you can do a Reference Transaction based on a previous transaction for up to a year after the previous transaction occurred. However, PayPal does not guarantee this to work for any transaction older than 7 - 30 days.*

See PayPal documentation for optional values for payment_type.