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 6864963
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T02:58:50+00:00 2026-05-27T02:58:50+00:00

I am getting PayPal’s IPN in array form like this: $ipn = array( ‘mc_gross’

  • 0

I am getting PayPal’s IPN in array form like this:

$ipn = array(
    'mc_gross' => '15.50',
    'protection_eligibility' => 'Eligible',
    'address_status' => 'confirmed',
    'item_number1' => '1',
    'tax' => '0.00',
    'item_number2' => '2',
    'payer_id' => 'XXXXXXXXXXXXX',
    'address_street' => '1 Main St',
    'payment_date' => '02:41:18 Nov 23, 2011 PST',
    'payment_status' => 'Completed',
    'charset' => 'windows-1252',
    'address_zip' => '95131',
    'mc_shipping' => '0.00',
    'mc_handling' => '0.00',
    'first_name' => 'Test',
    'mc_fee' => '0.75',
    'address_country_code' => 'US',
    'address_name' => 'Test User',
    'custom' => '',
    'payer_status' => 'verified',
    'business' => 'receiver@example.com',
    'address_country' => 'United States',
    'num_cart_items' => '2',
    'mc_handling1' => '0.00',
    'mc_handling2' => '0.00',
    'address_city' => 'San Jose',
    'payer_email' => 'payer@example.com',
    'mc_shipping1' => '0.00',
    'mc_shipping2' => '0.00',
    'txn_id' => '8RE82733S8684874F',
    'payment_type' => 'instant',
    'last_name' => 'User',
    'address_state' => 'CA',
    'item_name1' => 'trilogy2',
    'receiver_email' => 'receiver@example.com',
    'item_name2' => 'trilogy1',
    'payment_fee' => '0.75',
    'quantity1' => '1',
    'quantity2' => '1',
    'receiver_id' => 'XXXXXXXXXXXXX',
    'txn_type' => 'cart',
    'mc_gross_1' => '5.55',
    'mc_currency' => 'USD',
    'mc_gross_2' => '9.95',
    'residence_country' => 'US',
    'transaction_subject' => 'Shopping Carttrilogy2trilogy1',
    'payment_gross' => '15.50',
    '' => ''
    );

In this case customer has ordered only 2 items: 'item_name1' and 'item_name2'

Obviously, a customer can order X number of products and PayPal will include an 'item_nameX' in the notification data. Is there a way to go through the array and extract all names and assign them to variables so I will have something like:

$ordered_item1 = $ipn['item_name1'];
$ordered_item2 = $ipn['item_name2'];
...
$ordered_itemXYZ = $ipn['item_nameXYZ'];

Thanks for any help.

  • 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-27T02:58:51+00:00Added an answer on May 27, 2026 at 2:58 am

    If you have data named with a prefix followed by a count, you should be using an array, not separate variables. To fill an array with the item information:

    foreach ($ipn as $key => $value) {
        if (preg_match('/(?P<field>[a-z]+)_?(?P<i>\d+)/', $key, $parts)) {
            $ordered_items[(int) $parts['i']][$parts['field']] = $value;
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Getting a rendering error for this form: 'NoneType' object has no attribute 'widget' http://dpaste.com/88585/
Getting this error with jquery & jquery.form. Site has been live for awhile..upgraded to
I'm getting this error: Declaration of PayPal::raiseError() should be compatible with that of PEAR::raiseError()
I am getting back the IPN response from paypal. The payment_status is pending. How
I am getting back the IPN response from paypal. The payment_status is pending. How
So, this is a new one on me. My Paypal IPN has been working
I have downloaded this API . If you go to lib/Paypal/Profile/Handler/Array.php you will find
I have an array that looks like this: Array ( [TIMESTAMP] => 2012-01-04T21:36:32Z [CORRELATIONID]
Getting this error: 2009-09-03 12:44:02.307 xcodebuild[307:10b] warning: compiler 'com.apple.compilers.llvm.clang.1_0.analyzer' is based on missing compiler
The PayPal IPN Guide documentation says clearly Post the request to www.paypal.com or www.sandbox.paypal.com,

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.