class
This class is used to perform a recurring transaction with
add action.
RecurringAddTransaction is used to add a new recurring profile
either by submitting the data that defines the profile or by converting an
existing transaction into a profile. Upon successful creation of a profile,
PayPal activates the profile, performs the Optional Transaction if specified,
initiates the payment cycle, and returns a Profile ID (a 12-character string that
uniquely identifies the profile for searching and reporting). Upon failure, PayPal
does not generate the profile and returns an error message.
...............
// Populate data objects
...............
//Set the Recurring related information.
RecurringInfo recurInfo = new RecurringInfo();
// The date that the first payment will be processed.
// This will be of the format mmddyyyy.
recurInfo.setStart("01012009");
recurInfo.setProfileName ("PayPal");
// Specifies how often the payment occurs. All PAYPERIOD values must use
// capital letters and can be any of WEEK / BIWK / SMMO / FRWK / MONT /
// QTER / SMYR / YEAR
recurInfo.setPayPeriod ("WEEK");
// Create a new RecurringAddTransaction
RecurringAddTransaction trans = new RecurringAddTransaction(
user, connection, inv, card, recurInfo, PayflowUtility.getRequestId());
// Submit the transaction.
Response resp = trans.submitTransaction();
if (Resp != null)
{
// Get the Transaction Response parameters.
TransactionResponse trxnResponse = resp.getTransactionResponse();
if (trxnResponse != null)
{
System.out.println("RESULT = " + trxnResponse.getResult());
System.out.println("RESPMSG = " + trxnResponse.getRespMsg());
}
// Get the Recurring Response parameters.
RecurringResponse recurResponse = resp.getRecurringResponse();
if (recurResponse != null)
{
System.out.println("RPREF = " + recurResponse.getRPRef());
System.out.println("PROFILEID = " + recurResponse.getProfileId());
}
}
// Get the Context and check for any contained SDK specific errors.
Context ctx = resp.getTransactionContext();
if (ctx != null & ctx.getErrorCount() > 0)
{
System.out.println("/n" + "Errors = " + Ctx.ToString());
}
class
This class is used to perform a recurring transaction with
Cancel action.
* <p>
RecurringCancelTransaction is used to cancel the recurring profile
to deactivate the profile from performing further transactions. The profile is
marked as cancelled and the customer is no longer billed. PayPal records the
cancellation date.
</p>
...............
// Populate data objects
...............
* <p>
//Set the Recurring related information.
RecurringInfo recurInfo = new RecurringInfo();
recurInfo.setOrigProfileId ("RT0000001350");
* <p>
// Create a new RecurringCancelTransaction
RecurringCancelTransaction trans = new RecurringCancelTransaction(
user, connection, recurInfo, PayflowUtility.getRequestId());
* <p>
// Submit the transaction.
Response resp = trans.submitTransaction();
* <p>
if (Resp != null)
{
// Get the Transaction Response parameters.
TransactionResponse trxnResponse = resp.getTransactionResponse();
if (trxnResponse != null)
{
System.out.println("RESULT = " + trxnResponse.getResult());
System.out.println("RESPMSG = " + trxnResponse.getRespMsg());
}
* <p>
// Get the Recurring Response parameters.
RecurringResponse recurResponse = resp.getRecurringResponse();
if (recurResponse != null)
{
System.out.println("RPREF = " + recurResponse.getRPRef());
System.out.println("PROFILEID = " + recurResponse.getProfileId());
}
}
// Get the Context and check for any contained SDK specific errors.
Context ctx = resp.getTransactionContext();
if (ctx != null & ctx.getErrorCount() > 0)
{
System.out.println("/n" + "Errors = " + Ctx.ToString());
}
class
This class is used to perform a recurring transaction with
Inquiry action.
* <p>
RecurringInquiryTransaction is used to request two different sets of information:
To view the full set of payment information for a profile, include the
PAYMENTHISTORY=Y name/value pair with the Inquiry action.
To view the status of a customer's profile, submit an Inquiry action that does
not include the PAYMENTHISTORY parameter (alternatively, submit
PAYMENTHISTORY=N).
</p>
...............
// Populate data objects
...............
* <p>
//Set the Recurring related information.
RecurringInfo recurInfo = new RecurringInfo();
recurInfo.setOrigProfileId ("RT0000001350");
* <p>
// Create a new Recurring Inquiry Transaction.
RecurringInquiryTransaction trans = new RecurringInquiryTransaction(
user, connection, recurInfo, PayflowUtility.getRequestId());
* <p>
// Submit the transaction.
Response resp = trans.submitTransaction();
* <p>
if (Resp != null)
{
// Get the Transaction Response parameters.
TransactionResponse trxnResponse = resp.getTransactionResponse();
if (trxnResponse != null)
{
System.out.println("RESULT = " + trxnResponse.getResult());
System.out.println("RESPMSG = " + trxnResponse.getRespMsg());
}
* <p>
// Get the Recurring Response parameters.
RecurringResponse recurResponse = resp.getRecurringResponse();
if (recurResponse != null)
{
System.out.println("RPREF = " + recurResponse.getRPRef());
System.out.println("PROFILEID = " + recurResponse.getProfileId());
System.out.println("STATUS = " + recurResponse.getStatus());
System.out.println("PROFILENAME = " + recurResponse.getProfileName());
System.out.println("START = " + recurResponse.getStart());
System.out.println("TERM = " + recurResponse.getTerm());
System.out.println("NEXTPAYMENT = " + recurResponse.getNextPayment());
System.out.println("PAYPERIOD = " + recurResponse.getPayPeriod());
System.out.println("NEXTPAYMENT = " + recurResponse.getNextPayment());
System.out.println("TENDER = " + recurResponse.getTender());
System.out.println("AMT = " + recurResponse.getAmt());
System.out.println("ACCT = " + recurResponse.getAcct());
System.out.println("EXPDATE = " + recurResponse.getExpDate());
System.out.println("AGGREGATEAMT = " + recurResponse.getAggregateAmt());
System.out.println("AGGREGATEOPTIONALAMT = " + recurResponse.getAggregateOptionalAmt());
System.out.println("MAXFAILPAYMENTS = " + recurResponse.getMaxFailPayments());
System.out.println("NUMFAILPAYMENTS = " + recurResponse.getNumFailPayments());
System.out.println("RETRYNUMDAYS = " + recurResponse.getRetryNumDays());
System.out.println("STREET = " + recurResponse.getStreet());
System.out.println("ZIP = " + recurResponse.getZip());
}
}
// Get the Context and check for any contained SDK specific errors.
Context ctx = resp.getTransactionContext();
if (ctx != null & ctx.getErrorCount() > 0)
{
System.out.println("/n" + "Errors = " + Ctx.ToString());
}
class
This class is used to perform a recurring transaction with
modify action.
RecurringModifyTransaction is used to modify any profile value by
sending any subset of the profile parameters, including an Optional Transaction.
The Modify action is useful, for example, when an inactive customer wishes to
restart payments using a new valid credit card. The Modify action changes a
profiles STATUS to active but does not change the START date.
...............
// Populate data objects
...............
//Set the Recurring related information.
RecurringInfo recurInfo = new RecurringInfo();
recurInfo.setOrigProfileId ("RT0000001350");
recurInfo.setProfileName ("PayPal Inc.");
////////////////////////////////////
// Create a new Recurring modify Transaction.
RecurringModifyTransaction trans = new RecurringModifyTransaction(
user, connection, recurInfo, PayflowUtility.getRequestId());
// Submit the transaction.
Response resp = trans.submitTransaction();
if (Resp != null)
{
// Get the Transaction Response parameters.
TransactionResponse trxnResponse = resp.getTransactionResponse();
if (trxnResponse != null)
{
System.out.println("RESULT = " + trxnResponse.getResult());
System.out.println("RESPMSG = " + trxnResponse.getRespMsg());
}
// Get the Recurring Response parameters.
RecurringResponse recurResponse = resp.getRecurringResponse();
if (recurResponse != null)
{
System.out.println("RPREF = " + recurResponse.getRPRef());
System.out.println("PROFILEID = " + recurResponse.getProfileId());
}
}
// Get the Context and check for any contained SDK specific errors.
Context ctx = resp.getTransactionContext();
if (ctx != null & ctx.getErrorCount() > 0)
{
System.out.println("/n" + "Errors = " + Ctx.ToString());
}
class
This class is used to perform a recurring transaction with
Payment action.
RecurringPaymentTransaction action performs a real-time retry on
a transaction that is in the retry state. The response string is similar
to the string for Optional transactions, except that, upon approval,
the profile is updated to reflect the successful retry.
</p>
...............
// Populate data objects
...............
//Set the Recurring related information.
RecurringInfo recurInfo = new RecurringInfo();
recurInfo.setOrigProfileId ("RT0000001350");
// The date that the first payment will be processed.
// This will be of the format mmddyyyy.
RecurInfo.setPaymentNum ("01012009");
// Create a new Invoice data object with the Amount, Billing Address etc. details.
Invoice inv = new Invoice();
// Set Amount.
Currency amt = new Currency(new Double(25.12));
inv.setAmt (amt);
inv.setPoNum ("PO12345");
inv.setInvNum ("INV12345");
// Set the Billing Address details.
BillTo bill = new BillTo();
bill.setBillToStreet ("123 Main St.");
bill.setBillToZip ("12345");
inv.setBillTo (bill);
// Create a new RecurringPaymentTransaction.
RecurringPaymentTransaction trans = new RecurringPaymentTransaction(
user, connection, recurInfo, inv, PayflowUtility.getRequestId());
// Submit the transaction.
Response resp = trans.submitTransaction();
if (Resp != null)
{
// Get the Transaction Response parameters.
TransactionResponse trxnResponse = resp.getTransactionResponse();
if (trxnResponse != null)
{
System.out.println("RESULT = " + trxnResponse.getResult());
System.out.println("RESPMSG = " + trxnResponse.getRespMsg());
}
// Get the Recurring Response parameters.
RecurringResponse recurResponse = resp.getRecurringResponse();
if (recurResponse != null)
{
System.out.println("RPREF = " + recurResponse.getRPRef());
System.out.println("PROFILEID = " + recurResponse.getProfileId());
}
}
// Get the Context and check for any contained SDK specific errors.
Context ctx = resp.getTransactionContext();
if (ctx != null & ctx.getErrorCount() > 0)
{
System.out.println("/n" + "Errors = " + Ctx.ToString());
}
class
This class is used to perform a recurring transaction with
reactivate action.
RecurringReactivatetransaction reactivates a profile with inactive STATUS.
(Profiles can be deactivated for the following reasons: the term has completed,
the profile reached maximum allowable payment failures, or the profile is canceled.)
Reactivation gives the option to alter any profile parameter, including an
Optional Transaction and a new start date must be specified .
...............
// Populate data objects
...............
//Set the Recurring related information.
RecurringInfo recurInfo = new RecurringInfo();
recurInfo.setOrigProfileId ("RT0000001350");
// The date that the first payment will be processed.
// This will be of the format mmddyyyy.
recurInfo.setStart ("01012009");
////////////////////////////////////
// Create a new Recurring ReActivate Transaction.
RecurringReActivateTransaction trans = new RecurringReActivateTransaction(
user, connection, recurInfo, PayflowUtility.getRequestId());
// Submit the transaction.
Response resp = trans.submitTransaction();
if (Resp != null)
{
// Get the Transaction Response parameters.
TransactionResponse trxnResponse = resp.getTransactionResponse();
if (trxnResponse != null)
{
System.out.println("RESULT = " + trxnResponse.getResult());
System.out.println("RESPMSG = " + trxnResponse.getRespMsg());
}
// Get the Recurring Response parameters.
RecurringResponse recurResponse = resp.getRecurringResponse();
if (recurResponse != null)
{
System.out.println("RPREF = " + recurResponse.getRPRef());
System.out.println("PROFILEID = " + recurResponse.getProfileId());
}
}
// Get the Context and check for any contained SDK specific errors.
Context ctx = resp.getTransactionContext();
if (ctx != null & ctx.getErrorCount() > 0)
{
System.out.println("/n" + "Errors = " + Ctx.ToString());
}