Giter Club home page Giter Club logo

Comments (8)

craigchristenson avatar craigchristenson commented on June 18, 2024

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.

JAW-Dev avatar JAW-Dev commented on June 18, 2024

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.

craigchristenson avatar craigchristenson commented on June 18, 2024

"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.

JAW-Dev avatar JAW-Dev commented on June 18, 2024

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.

JAW-Dev avatar JAW-Dev commented on June 18, 2024

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.

craigchristenson avatar craigchristenson commented on June 18, 2024

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.

JAW-Dev avatar JAW-Dev commented on June 18, 2024

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.

rayanmurtaza avatar rayanmurtaza commented on June 18, 2024

sir when i use currency 'PKR' then bad parameter error

from 2checkout-php.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.