Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6773439
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T15:40:07+00:00 2026-05-26T15:40:07+00:00

On my site user can fill their order basket with items. Once this is

  • 0

On my site user can fill their order basket with items.

Once this is finished they can click the checkout button.

I want them to checkout using PayPal.

Once the user click on the checkout button the user is redirected to PayPal and sees an overview of the products to pay for.

If the user goes through the payment process the user is redirected to my success page.

However I expect the success page to also receive the transaction id of the payment but paypal only sends back a token and a payerid.

My checkout form looks like this:

<form action="/en/checkout">
  <input type="submit" name="submit" value="Checkout">
</form>

My code that does the checkout is:

function checkoutAction()
{
    $request = $this->getRequest();

    require_once(LIB_PATH.'/MFW/Paypal/Flows/Paypal_NVP.php');
    $paypal_nvp = new MFW_Paypal_NVP();

    // this should normally be filled by looping though the basket items
    $data = array('L_PAYMENTREQUEST_0_NAME0'=>'Single License',
                  'L_PAYMENTREQUEST_0_NUMBER0'=>'1111-2222-3333-4444-5555-6666-7777-8888',
                  'L_PAYMENTREQUEST_0_AMT0'=>39.99, // or enterprise 299.00
                  'L_PAYMENTREQUEST_0_QTY0'=>1,
                  );

    $_SESSION['Payment_Amount'] = 39.99;

    $result = $paypal_nvp->CallShortcutExpressCheckout(59.98, $data);

    $ack = strtoupper($result['ACK']);
    if($ack == 'SUCCESS' || $ack == 'SUCCESSWITHWARNING') {
        $paypal->RedirectToPayPal($result['TOKEN']);
        exit();
    }
}

The code in the Paypal_NCP class:

function generate_nvp_string($total_value, $data = array())
{
    $params = array('PAYMENTREQUEST_0_AMT'=>$total_value,
                    'PAYMENTREQUEST_0_PAYMENTACTION'=>$this->payment_type,
                    'RETURNURL'=>$this->return_url,
                    'CANCELURL'=>$this->cancel_url,
                    'PAYMENTREQUEST_0_CURRENCYCODE'=>$this->currency,
                    );

    $params = array_merge($params, $data);

    $nvp_string = '';
    foreach($params as $name => $value) {
        $nvp_string.= '&'.$name.'='.$value;
    }

    // example string
    // &PAYMENTREQUEST_0_AMT=39.99&PAYMENTREQUEST_0_PAYMENTACTION=Sale&RETURNURL=http://return-address&CANCELURL=http://cancel-address&PAYMENTREQUEST_0_CURRENCYCODE=EUR&L_PAYMENTREQUEST_0_NAME0=Single License&L_PAYMENTREQUEST_0_NUMBER0=1111-2222-3333-4444-5555-6666-7777-8888&L_PAYMENTREQUEST_0_AMT0=39.99&L_PAYMENTREQUEST_0_QTY0=1

    return $nvp_string;
}

function CallShortcutExpressCheckout($total_value, $data = array())
{
    $_SESSION['currencyCodeType'] = $this->currency;
    $_SESSION['PaymentType'] = $this->payment_type;

    $result = $this->hash_call('SetExpressCheckout', $this->generate_nvp_string($total_value, $data));

    $ack = strtoupper($result['ACK']);
    if ($ack == 'SUCCESS' || $ack == 'SUCCESSWITHWARNING') {
        $_SESSION['TOKEN'] = urldecode($result['TOKEN']);
    }

    return $result;
}

So how do I get the information of the transaction for me to be able to process the payment in the backoffice? (I need an transaction ID for this)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T15:40:07+00:00Added an answer on May 26, 2026 at 3:40 pm

    You’re only calling SetExpressCheckout. In order to finalize a transaction with Express Checkout, you must also call (optional) GetExpressCheckoutDetails to get the PayerID (a unique identifier of the buyer) and (required) DoExpressCheckoutPayment.

    To recap:
    To use Express Checkout, you would call the SetExpressCheckout API. In the API call, you specify the details of the products, amounts, and the RETURNURL. This is what you’re doing in the code above.
    Once you post this data to PayPal’s API endpoint, you receive a token in return. You would then redirect the buyer, and append the token to the following URL: https://www.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=EC-XXXXXXX

    Once the buyer has agreed to your purchase, he is redirected back to the URL you specified in the RETURNURL.
    You should now show the order confirmation, and call the GetExpressCheckoutDetails API**.
    When calling GetExpressCheckoutDetails, supply the token. In the GetExpressCheckoutDetails API response you’ll find a PayerID.

    Now you’re ready to call DoExpressCheckoutPayment, and charge the buyer. Remember to include both the token and the payerID when calling DoExpressCheckoutPayment.

    With regards to IPN: You don’t really need it anymore, as you’ll also get the TransactionID back in the API response to DoExpressCheckoutPayment.
    IPN would be useful if you would subsequently want to ‘keep track’ of the transaction. E.g., get notified in case of any refunds / chargebacks, etc.
    This simply requires setting up an IPN script and including NOTIFYURL=http://…. in both SetExpressCheckout and DoExpressCheckoutPayment.

    ** The PayerID is appended in the GET of your RETURNURL as well. So you could skip calling GetExpressCheckoutDetails if you wanted to.

    (Partial copy of my answer at Why is DoExpressCheckoutPayment required for Paypal? )

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

On my site a authorized user can create a content type called protocol. This
Firstly this site is based on guests who are interested in selling their items
I am working on social networking site where user can post photo and text
I want to make a site where there user can basically navigate the web
I have a credit system set up on my site where user A can
A user can upload a picture on my site at which point jQuery inserts
On a site I'm doing a user can enter a search string like do
So on my site, a user can post a comment on 2 things: a
I have a page where a user can import data to the site. either
I'm working on a site where I've got a page where a user can

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.