I am getting the same response for both success and fail transaction I am on a testing sandbox mode and using hosted checkout method and my order is recurring billing here is my response from 2checkout
'sid' => '101346602',
'middle_initial' => '',
'li_0_name' => 'Business_3_8.00',
'key' => 'F22EBC18AB05AAC86905E706410FCF0F',
'state' => 'AS',
'email' => 'manash149#gmail.com',
'li_0_type' => 'product',
'li_0_duration' => 'Forever',
'order_number' => '9093731870208',
'lang' => 'en',
'currency_code' => 'USD',
'invoice_id' => '9093731870217',
'li_0_price' => '8.00',
'total' => '8.00',
'credit_card_processed' => 'Y',
'zip' => '781001',
'li_0_quantity' => '1',
'cart_weight' => '0',
'fixed' => 'Y',
'_token' => 'NK7YGNjpXem5pY7JK9VlYA1rT4cIqgY4EFrv8N81',
'last_name' => '',
'li_0_product_id' => '',
'street_address' => 'asd',
'city' => 'Guwahati',
'li_0_tangible' => 'N',
'li_0_description' => '',
'ip_country' => 'India',
'country' => 'IND',
'merchant_order_id' => '',
'demo' => 'Y',
'pay_method' => 'CC',
'cart_tangible' => 'N',
'phone' => '9706353416 9706353416',
'li_0_recurrence' => '1 Month',
'street_address2' => '',
'first_name' => 'Manash',
'card_holder_name' => 'Manash',
Used this card for failed transactions
Credit Card Number: 4333433343334333
Expiration date: 10/2020
cvv:123
For more information Take a look at
https://www.2checkout.com/documentation/libraries-php-tutorial
The following card info will cause a failure in sandbox:
CC# 4333433343334333
MM / YYYY 10 / 2020
CVV 123
I just verified this myself, which test card data were you using?
Related
I have an existing implementation of this class processing subscriptions by credit card but I now need to add the facility to accept payment by eCheck but I am unsure of how to change this portion of the code:
'payment' => array(
'creditCard' => array(
'cardNumber' => '4111111111111111',
'expirationDate' => '2016-08'
)
),
I have come up with the following from referencing the AIM guide pdf and AIM guide XML pdf
'payment' => array(
'bankAccount' => array( // x_method equivalent ?
'routingNumber' => '', // x_bank_aba_code equivalent ?
'accountNumber' => '', // x_bank_acct_num equivalent ?
'nameOnAccount' => '', // x_bank_acct_name equivalent ?
'bankName' => '', // x_bank_name equivalent ?
'echeckType' => 'WEB' // x_echeck_type equivalent
/*
x_bank_acct_type has no equivalent ?
*/
)
),
but there appears to be some discrepancies between the required fields?
Any pointers before I start on this would be greatly appreciated.
Looking at Authorize.Net's documentation this should work:
'payment' => array(
'bankAccount' => array(
'accountType' => '', // 'checking'
'routingNumber' => '',
'accountNumber' => '',
'nameOnAccount' => ''
)
),
Following on from John's answer this is the complete code I used to solve this for anyone finding this through a google search:
$xml->ARBCreateSubscriptionRequest(array(
'subscription' => array(
'name' => 'SubscriptionName',
'paymentSchedule' => array(
'interval' => array(
'length' => '1',
'unit' => 'months'
),
'startDate' => date('Y-m-d', time()), // Format: YYYY-MM-DD
'totalOccurrences' => '9999' // To submit a subscription with no end date (an ongoing subscription), this field must be submitted with a value of 9999
),
'amount' => $eCart1->GrandTotal(), // total monthly subscription
'payment' => array(
'bankAccount' => array(
'accountType' => ((isset($_POST["accountType"]))?$_POST["accountType"]:""), // options available are checking or businessChecking in this instance
'routingNumber' => ((isset($_POST["routingNumber"]))?$_POST["routingNumber"]:""),
'accountNumber' => ((isset($_POST["accountNumber"]))?$_POST["accountNumber"]:""),
'nameOnAccount' => ((isset($_POST["nameOnAccount"]))?$_POST["nameOnAccount"]:""),
'echeckType' => ((isset($_POST["echeckType"]))?$_POST["echeckType"]:"") // if businessChecking is chosen then 'CCD' else 'WEB'
)
),
'customer' => array(
'id' => "'".$_SESSION['clientID']."'",
'email' => "'".((isset($_POST["email"]))?$_POST["email"]:"")."'"
),
'billTo' => array(
'firstName' => "'".((isset($_POST["firstname"]))?$_POST["firstname"]:"")."'",
'lastName' => "'".((isset($_POST["lastname"]))?$_POST["lastname"]:"")."'",
'company' => "'".((isset($_POST["company"]))?$_POST["company"]:"")."'",
'address' => "'".((isset($_POST["street1"]))?$_POST["street1"]:"")."'",
'city' => "'".((isset($_POST["city"]))?$_POST["city"]:"")."'",
'state' => "'".((isset($_POST["state_province"]))?$_POST["state_province"]:"")."'",
'zip' => "'".((isset($_POST["postcode"]))?$_POST["postcode"]:"")."'"
)
)
));
I am using this GitHub code for hotel listing and hotel details section https://github.com/dyatlov/Expedia-PHP-API
for the booking process i am using this code:
$info = $expedia->getHotelInfo( $_REQUEST['hotelid'] );
echo '<pre>';
var_export( $info );
// book hotel
$expedia->set_method('POST');
$expedia->set_protocol('https://book.');
$result = $expedia->res( array(
'hotelId' => $_REQUEST['hotelid'],
'arrivalDate' => '7/27/2015',
'departureDate' => '7/29/2015',
'supplierType' => 'E',
'rateKey' => '234be234234afd',
'roomTypeCode' => 12345,
'rateCode' => '123123',
'chargeableRate' => '150.0',
'room1' => 1,
'room1FirstName' => 'John',
'room1LastName' => 'Guest',
'room1BedTypeId' => 1234,
'room1SmokingPreference' => 'no',
'email' => 'test#test.com',
'firstName' => 'Tester',
'lastName' => 'Tester',
'homePhone' => '1234567',
'workPhone' => '1234567',
'creditCardType' => 'VI',
'creditCardNumber' => '41111111111111111',
'creditCardIdentifier' => '123',
'creditCardExpirationMonth' => '05',
'creditCardExpirationYear' => '2017',
'address1' => 'travelnow',
'city' => 'Moscow',
'stateProvinceCode' => null,
'countryCode' => 'RU',
'postalCode' => '3357'
) );
but here I integrate this code in the WordPress and from the request URL i will get the hotel id now please tell me what is specified process to make the onsite booking for Expedia and how can get the confirmation and also cancel acknowledgement.I am doing all this job in the development mode.
I'm trying to check the data that paypal sends to my notify_url after a transaction has been paid (in this case using the sandbox).
I've tried the sample code from paypal with fsockopen but I just couldn't get it to work properly. I also tried with cURL by manually giving a certificate, but it didn't turn out well either.
However after some changes, I managed to find a solution :
<?php
$_POST = array('mc_gross' => '9.90',
'protection_eligibility' => 'Eligible',
'address_status' => 'confirmed',
'payer_id' => '5PK5H93BE5RAQ',
'tax' => '0.00',
'address_street' => '1 Main St',
'payment_date' => '12:13:29 Jan 12, 2012 PST',
'payment_status' => 'Pending',
'charset' => 'windows-1252',
'address_zip' => '95131',
'first_name' => 'Test',
'address_country_code' => 'US',
'address_name' => 'Test User',
'notify_version' => '3.4',
'custom' => '523368657',
'payer_status' => 'verified',
'business' => 'seller_1326059109_biz#yahoo.fr',
'address_country' => 'United States',
'address_city' => 'San Jose',
'quantity' => '1',
'verify_sign' => 'AGilT0jx3itxd3XAujXRvUPipg93ATqSM88ML-PAwAoa7xGkRSWXhVR8',
'payer_email' => 'buyer_1326398444_per#yahoo.fr',
'txn_id' => '1C254380JG793833D',
'payment_type' => 'instant',
'last_name' => 'User',
'address_state' => 'CA',
'receiver_email' => 'seller_1326059109_biz#yahoo.fr',
'receiver_id' => 'FKBDH7FDLECEQ',
'pending_reason' => 'multi_currency',
'txn_type' => 'web_accept',
'item_name' => 'Compte premium winker',
'mc_currency' => 'EUR',
'item_number' => '',
'residence_country' => 'US',
'test_ipn' => '1',
'handling_amount' => '0.00',
'transaction_subject' => '523368657',
'payment_gross' => '',
'shipping' => '0.00',
'ipn_track_id' => '1v3OWX6MBMqE6Oe6-BSmCA');
$req = '?cmd=_notify-validate';
foreach ($_POST as $key => $value) {
$value = urlencode(stripslashes($value));
$req .= "&$key=$value";
}
$url = 'https://sandbox.paypal.com/cgi-bin/webscr'.$req;
echo '<p>browse link</p>';
$content = file_get_contents($url);
var_dump($content);
I do get a result but it is "INVALID", whereas if I open the link on my browser (with the exact same informations), it is "VERIFIED" !
Any ideas ?
Thanks in advance for your replies
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.
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;
}
}
I am working on this FedEx web service integration project for some time. I am using PHP to make calls to the FedEx server. Everything seems to be working properly.
But I am having problems with CustomerReferences fields appearing in the original fedex request that is sent to the server. I am using the ShipService_v7.wsdl. I asked FedEx tech support saying that would not be able to help with PHP code. But my problem is even the sample code provided by fedex is not able to generate the customerreferences fields in the request sent to the server.
Would you guys happen to know whats the deals with this?
EDIT:
Code that is generating the XML file being sent to the fedex web server,
$client = new SoapClient($path_to_wsdl, array('trace' => 1)); // Refer to http://us3.php.net/manual/en/ref.soap.php for more information
$request['WebAuthenticationDetail'] = array('UserCredential' =>
array('Key' => $DEVELOPER_KEY, 'Password' => $DEVELOPER_PASSWORD)); // Replace 'XXX' and 'YYY' with FedEx provided credentials
$request['ClientDetail'] = array('AccountNumber' => $FEDEX_ACCOUNT_NUMBER, 'MeterNumber' => $FEDEX_METER_NUMBER);// Replace 'XXX' with your account and meter number
$request['TransactionDetail'] = array('CustomerTransactionId' => '*** Ground International Shipping Request v7 using PHP ***');
$request['Version'] = array('ServiceId' => 'ship', 'Major' => '7', 'Intermediate' => '0', 'Minor' => '0');
$request['RequestedShipment'] = array('ShipTimestamp' => date('c'),
'DropoffType' => 'REGULAR_PICKUP', // valid values REGULAR_PICKUP, REQUEST_COURIER, DROP_BOX, BUSINESS_SERVICE_CENTER and STATION
'ServiceType' => 'FEDEX_GROUND', // valid values STANDARD_OVERNIGHT, PRIORITY_OVERNIGHT, FEDEX_GROUND, ...
'PackagingType' => 'YOUR_PACKAGING', // valid values FEDEX_BOX, FEDEX_PAK, FEDEX_TUBE, YOUR_PACKAGING, ...
'Shipper' => array('Contact' => array('PersonName' => 'Sender Name',
'CompanyName' => 'Company Name',
'PhoneNumber' => '0805522713'),
'Address' => array('StreetLines' => array('Address Line 1'),
'City' => 'Memphis',
'StateOrProvinceCode' => 'TN',
'PostalCode' => '38110',
'CountryCode' => 'US')),
'Recipient' => array('Contact' => array('PersonName' => 'Recipient Name',
'CompanyName' => 'Company Name',
'PhoneNumber' => '9012637906'),
'Address' => array('StreetLines' => array('Address Line 1'),
'City' => 'Richmond',
'StateOrProvinceCode' => 'BC',
'PostalCode' => 'V7C4V4',
'CountryCode' => 'CA',
'Residential' => false)),
'ShippingChargesPayment' => array('PaymentType' => 'SENDER', // valid values RECIPIENT, SENDER and THIRD_PARTY
'Payor' => array('AccountNumber' => $FEDEX_ACCOUNT_NUMBER, // Replace 'XXX' with payors account number
'CountryCode' => 'US')),
'InternationalDetail' => array('DutiesPayment' => array('PaymentType' => 'SENDER', // valid values RECIPIENT, SENDER and THIRD_PARTY
'Payor' => array('AccountNumber' => $FEDEX_ACCOUNT_NUMBER, // Replace 'XXX' with payor's account number
'CountryCode' => 'CA')),
'DocumentContent' => 'DOCUMENTS_ONLY',
'CustomsValue' => array('Amount' => 100.0, 'Currency' => 'USD'),
'Commodities' => array('0' => array('NumberOfPieces' => 1,
'Description' => 'Books',
'CountryOfManufacture' => 'US',
'Weight' => array('Value' => 1.0, 'Units' => 'LB'),
'Quantity' => 1,
'QuantityUnits' => 'EA',
'UnitPrice' => array('Amount' => 1.000000, 'Currency' => 'USD'),
'CustomsValue' => array('Amount' => 100.000000, 'Currency' => 'USD'))),
'ExportDetail' => array('B13AFilingOption' => 'FILED_ELECTRONICALLY')),
'LabelSpecification' => array('LabelFormatType' => 'COMMON2D', // valid values COMMON2D, LABEL_DATA_ONLY
'ImageType' => 'PNG', // valid values DPL, EPL2, PDF, ZPLII and PNG
'LabelStockType' => 'PAPER_7X4.75'),
'RateRequestTypes' => array('ACCOUNT'), // valid values ACCOUNT and LIST
'PackageCount' => 1,
'PackageDetail' => 'INDIVIDUAL_PACKAGES',
'RequestedPackageLineItems' => array('SequenceNumber' => 1,
'Weight' => array('Value' => 20.0, 'Units' => 'LB')), // valid values LB and KG
'CustomerReferences' => array('0' => array('CustomerReferenceType' => 'CUSTOMER_REFERENCE', 'Value' => 'TC007_07_PT1_ST01_PK01_SNDUS_RCPCA_POS')));
Expected Output :
... XML Stuff ...
<ns1:RequestedPackageLineItems>
<ns1:SequenceNumber>1</ns1:SequenceNumber>
<ns1:Weight>
<ns1:Units>LB</ns1:Units>
<ns1:Value>20</ns1:Value>
</ns1:Weight>
<ns1:CustomerReferences>
<ns1:CustomerReferenceType>CUSTOMER_REFERENCE</ns1:CustomerReferenceType>
<ns1:Value>I am a customer reference</ns1:Value>
</ns1:CustomerReferences>
</ns1:RequestedPackageLineItems>
... XML Stuff ...
Current Output
<ns1:RequestedPackageLineItems>
<ns1:SequenceNumber>1</ns1:SequenceNumber>
<ns1:Weight>
<ns1:Units>LB</ns1:Units>
<ns1:Value>20</ns1:Value>
</ns1:Weight>
</ns1:RequestedPackageLineItems>
add customer reference under addPackageLineItem1
like this:
'Dimensions' => array(
'Length' => 20,
'Width' => 20,
'Height' => 10,
'Units' => 'IN'),
'CustomerReferences' => array(
'0' => array(
'CustomerReferenceType' => 'CUSTOMER_REFERENCE',
'Value' => '123456'
))