简体   繁体   中英

PayPal Payflow Pro: What should the originId be for reference transactions?

I am using PayPal's Payflow Pro SDK . I am trying to set something up where users can save and reuse their credit card after using it once. I think (correct me if I'm wrong) the right process to do this is as follows:

  1. Submit regular payment transaction
  2. In the response to this transaction, there should be some sort of code that corresponds to that credit card
  3. Save this code instead of saving the credit card data directly
  4. Use this code as the originId parameter in a reference transaction to process orders (so no credit card is needed for the transaction, only the code)

What I can't figure out is what the code should actually be. When I submit the initial transaction, there are a bunch of codes that come back (ex: PNREF, AUTHCODE). I can't figure out which is supposed to be the one that I store and then use as the origin id in the reference transaction. I've tried using a bunch of different ones, and each comes back with an error saying "Invalid tender".

Below is a code snippet of my code for the reference transaction part:

public Response processOrderViaReferenceTransaction(String originId){
    UserInfo userInfo = new UserInfo("user", "vendor", "partner", "pwd"); //my actual username/password are in my code, not this
    PayflowConnectionData connection = new PayflowConnectionData("pilot-payflowpro.paypal.com", 443, 45, "", 0, "", "");
    String requestId = PayflowUtility.RequestId;

    Invoice invoice = new Invoice();
    CultureInfo us = new CultureInfo("en-US");
    String usCurrency = "USD";
    Currency amount = new Currency(new decimal(2.00), usCurrency);
    invoice.Amt = amount;

    ReferenceTransaction referenceTransaction = new ReferenceTransaction("S", originId, userInfo, connection, invoice, requestId);
    referenceTransaction.Verbosity = "HIGH";

    Response response = referenceTransaction.SubmitTransaction();
    return response;
}

Does anyone know what I am doing wrong?

Page 40 of the PayFlow Pro Developer guide ...

The PNREF returned in the original transaction is valid for use in reference transactions for a period of 12 months.

A PNREF returned by Account Verification also can be used in a reference transaction.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM