Comments (8)
This issue is occurring because total
is being passed along with the lineItems
. When total
is passed, the lineItems
are ignored as they are not being used to calculate the total. If you remove total
from your request the lineItems
will be used on the sale and they will be listed on the sale in the sandbox dashboard. Please let me know if this resolves your issue or if I can help further.
from 2checkout-php.
I removed total
, and even tried removing price
, and it still didn't return a response with the lineItems or show it setup for recurring in the sandbox.
Which by the way, I don't think the sandbox is working correctly. I've been working on this all week, and every sale showed Approved in the admin (using the example info), but al of a sudden yesterday It started showing Pending Payout. Maybe there's something wrong with the sandbox?
from 2checkout-php.
"Pending Payout" means that the sale was captured. 2Checkout intangible sales will capture automatically after passing fraud review. In the sandbox, the billing address is is used to determine the fraud status which will trigger the capture behind the scenes.
The issue is most likely with the values being passed. As I cannot see them in your example, I did a test in the sandbox using the same keys you are using and hard coded values and was able to create a recurring sale.
Request
<?php
require_once("lib/Twocheckout.php");
Twocheckout::privateKey("REDACTED");
Twocheckout::sellerId("REDACTED");
Twocheckout::sandbox(true);
try {
$charge = Twocheckout_Charge::auth(array(
"merchantOrderId" => "123",
"token" => ''REDACTED'',
"currency" => 'USD',
"lineItems" => array(
array(
"type" => 'product',
"price" => "5.00",
"productId" => "123",
"name" => "Test Product",
"quantity" => "1",
"tangible" => "N",
"startupFee" => "1.00",
"recurrence" => "1 Month",
"description" => "This is a test"
)
),
"billingAddr" => array(
"name" => 'Testing Tester',
"addrLine1" => '123 Test St',
"city" => 'Columbus',
"state" => 'OH',
"zipCode" => '43123',
"country" => 'USA',
"email" => '[email protected]'
)
));
if ($charge['response']['responseCode'] == 'APPROVED') {
print_r($charge);
}
} catch (Twocheckout_Error $e) {
echo $e->getMessage();
}
Response
Array
(
[validationErrors] =>
[response] => Array
(
[type] => AuthResponse
[currencyCode] => USD
[lineItems] => Array
(
[0] => Array
(
[duration] => Forever
[options] => Array
(
)
[price] => 5.00
[quantity] => 1
[recurrence] => 1 Month
[startupFee] => 1.00
[productId] => 123
[tangible] => N
[description] => This is a test
[name] => Test Product
[type] => product
)
)
[transactionId] => 9093723345798
[billingAddr] => Array
(
[addrLine1] => 123 Test St
[addrLine2] =>
[city] => Columbus
[zipCode] => 43123
[phoneNumber] =>
[phoneExtension] =>
[email] => [email protected]
[country] => USA
[name] => Testing Tester
[state] => OH
)
[shippingAddr] => Array
(
[addrLine1] =>
[addrLine2] =>
[city] =>
[zipCode] =>
[phoneNumber] =>
[phoneExtension] =>
[email] =>
[country] =>
[name] =>
[state] =>
)
[merchantOrderId] => 123
[orderNumber] => 9093723345789
[recurrentInstallmentId] =>
[responseMsg] => Successfully authorized the provided credit card
[responseCode] => APPROVED
[total] => 6.00
[errors] =>
)
[exception] =>
)
from 2checkout-php.
Cool, I'll give it a try with hand coding the values again and replacing them one by one to find the issue.
from 2checkout-php.
OK so I figured out what was the issue. The membership system I'm building this for has "Day" as an option for recurrence. 2checkout doesn't accept "Day" as a recurrence option.
That's why I wasn't able to get it working. In the documentation it does state that, but I thought it was just an example, not the only options you can use.
Thanks for you help though.
from 2checkout-php.
I'm glad to hear it man, sorry it wan't more clear. I'll see if the 2Checkout integrations team can get some better examples in the docs.
from 2checkout-php.
Yeah, that would be great. The documentation is vague in spots. There are a lot of areas that need explanation that don't have it.
from 2checkout-php.
sir when i use currency 'PKR' then bad parameter error
from 2checkout-php.
Related Issues (20)
- Twocheckout_Sale::stop Recurring item problem HOT 2
- Start recurring billing after a period of time. HOT 1
- Note on Refunds
- Note on Charges
- Translations HOT 1
- Fatal error: Class 'Twocheckout_Charge' not found
- Email addresses with tags (e.g. [email protected])
- Sell already created product on https://sandbox.2checkout.com/sandbox/products/list_products HOT 1
- Bad request - parameter error HOT 6
- "2Checkout Payments Failed: ‘Unauthorized’" HOT 1
- Unable to process the request HOT 1
- twocheckoutpp- Item Id / product description not present in order notification from 2co
- <!-- Bad browser, no cookie --> HOT 3
- Tangible won't set up to 'Y' HOT 1
- Private key Deprecated in 2checkout
- how to save user token information ?
- Call to undefined method Twocheckout::sandbox() HOT 2
- Authorization Failed HOT 1
- Doesn't work with PHP8.1 HOT 1
- 2checkout pho cash square
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from 2checkout-php.