Giter Club home page Giter Club logo

2checkout-php's People

Contributors

craigchristenson avatar jmcconnell91 avatar luclanet avatar maskas avatar necromant2005 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

2checkout-php's Issues

Namespace when using laravel

This package lacks a namespace hence , creating a provider and facade using laravel framework becomes very dificult

"curl url failed" Error

I'm getting "curl url failed" error when using admin api.

$args = array(
'sale_id' => "1011111663425"    
); 
try {
    $result = Twocheckout_Sale::stop($args);
} catch (Exception $e) {
}

And at the top of this code:

Twocheckout::privateKey(twoco_private_key);
    Twocheckout::sellerId(twoco_seller_id);

    // Your username and password are required to make any Admin API call.
    Twocheckout::username(twoco_api_username);
    Twocheckout::password(twoco_api_password);

    // If you want to turn off SSL verification (Please don't do this in your production environment)
    Twocheckout::verifySSL(false);  // this is set to true by default

    // To use your sandbox account set sandbox to true
    Twocheckout::sandbox(true);
    return true;

Can't figure out what is wrong?Any help will be appreciated.Thanks.

Server info:
OpenSSL 1.0.1e-fips 11 Feb 2013
PHP 5.4.16 (cli) (built: Jun 23 2015 21:17:27)

Note on Charges

I was having a terrible time getting my charges to go through until I went to the Dashboard > Account > Site Settings and turned off Demo Mode.

My commentary is that this is yet another reason why Stripe gets a higher score from me on developer friendliness.

twocheckoutpp- Item Id / product description not present in order notification from 2co

Issue is with twochcekoutpp extension: Integration is perfect but the sale notification from 2co [email protected] doesn't contain product name and it is really confusing, where as the 2co api card notification contain complete product name:
Here is the notiication email:


2Checkout.com Order Number : 2065XXXXXX
Merchant Order ID : 5XXXXX

Distributed By:
Example International Ltd ( www.example.org )

Contents of your order :
Cart ID : 5XXXX
Vendor Product ID : 5XXXX
Product Description : Vendor site cart purchase: Cart id 56637 (This should be product name)
Product Name : Cart purchase: 5XXXX
Quantity : 1
Base Price : 50.00

Total : 50.00 ( USD )

Customer Information
James XXXX
IP: XXX>XXX>XXX>XXX IP Location: Pullman ( United States )
[email protected]
5XXXXXX
PO Box XXX
CxXXXXXXXX
United States ( USA)
Please help if something should be changed in twocheckoutpp.php

Direct Checkout integration

Greetings guys,

Thanks for the API. Please could you add an option to switch methods for the payment.
https://www.2checkout.com/direct-checkout/

I think the option to switch your payment options would be useful for some of us. It would simply add the necessary JS code line. I've managed to do this on my own, but I think it might be useful for your API.

Let me know your thoughts please if it's going to be added.

Thanks!

Unable to process the request

Hi,
I always get this message if lineItems is enabled Unable to process the request
Here is my code

`
$charge = Twocheckout_Charge::auth(array(

    "merchantOrderId" => "123",
    "token"      => $_POST['token'],
    "currency"   => 'USD',
    // "total"      => '10.00',
    "billingAddr" => array(
        "name" => 'Testing Tester 1',
        "addrLine1" => '123 Test St',
        "city" => 'Columbus',
        "state" => 'OH',
        "zipCode" => '43123',
        "country" => 'USA',
        "email" => '[email protected]',
        "phoneNumber" => '555-555-5555'
    ),
    "lineItems" => array(
		"type" => "product",
		"name" => "Tet",
		"price" => "10.00",
		// "tangible" => "Y",
		"recurrence" => "1 Month",
		"duration" => "1 Week",
		// "quantity" => 1,
		"startupFee" => "1.00",
		// "productId" => "123",
		"description" => "This is a test"
	)
));`

Could you please light me what's wrong with my code?

Bad request - parameter error

I have been trying to work with the sandbox api, but i am unable to determine which parameter is causing the bad parameter error.Also, in the API side i do not see any notification about any missing parameter etc.Below is our payload.

$charge = Twocheckout_Charge::auth(array(

            "sellerId" => "*********",

            "merchantId" => "123",

            "token"      => $_POST['token'],

            "currency"   => 'USD',

            "lineitems" => array(

                "type" => 'product',

                "name" => 'Example Product',

                "recurrence" => '1 Month',

                "duration" => '1 Year',

                "price" => '1.00',

                "billingAddr" => array(

                    "name" => 'Testing Tester',

                    "addrLine1" => '123 Test St',

                    "city" => 'Columbus',

                    "state" => 'OH',

                    "zipCode" => '43123',

                    "country" => 'USA',

                    "email" => '[email protected]',

                    "phoneNumber" => '555-555-5555'

                ),

                "shippingAddr" => array(

                    "name" => 'Testing Tester',

                    "addrLine1" => '123 Test St',

                    "city" => 'Columbus',

                    "state" => 'OH',

                    "zipCode" => '43123',

                    "country" => 'USA',

                    "email" => '[email protected]',

                    "phoneNumber" => '555-555-5555'

                )

            )));

Order with "lineItems" do not seem to work

We use the 2CO PHP library and can not pass the orders successfully (in the sandbox) using the lineItems object. Without lineItems, things work ok but we need lineItems for using the recurring payments feature.

But get a "Unable to process the request" request with HTTP 400 status. It seems like we send the request as expected but it fails. Are we missing anything?

The complete code is as:

$charge = Twocheckout_Charge::auth(array(
    "merchantOrderId" => "123",
    "token" => $twoCheckoutToken,
    "currency" => 'USD',
    //"total" => '10.00',
    "lineItems" => array(
        "name" => 'TEST PRODUCT',
        "type" => 'product',
        "quantity" => '1',
        "price" => '10.00'
    ),
    "billingAddr" => array(
        "name" => 'Testing Tester',
        "addrLine1" => '123 Test St',
        "city" => 'Columbus',
        "state" => 'OH',
        "zipCode" => '43123',
        "country" => 'USA',
        "email" => '[email protected]',
        "phoneNumber" => '555-555-5555'
    ),
    "shippingAddr" => array(
        "name" => 'Testing Tester',
        "addrLine1" => '123 Test St',
        "city" => 'Columbus',
        "state" => 'OH',
        "zipCode" => '43123',
        "country" => 'USA',
        "email" => '[email protected]',
        "phoneNumber" => '555-555-5555'
    )
), 'array');
if ($charge['response']['responseCode'] == 'APPROVED') {
    echo "Thanks for your Order!";
}

Once we remove this part:

"lineItems" => array(
    "name" => 'TEST PRODUCT',
    "type" => 'product',
    "quantity" => '1',
    "price" => '10.00'
),

it works (but we need that part).

"2Checkout Payments Failed: ‘Unauthorized’"

"2Checkout Payments Failed: ‘Unauthorized’"

I confirm its production URL and all API keys are correct

Card working well with linode or digitalocean, but it keep fail with 2checkout ?

Please guide, we just getting "2Checkout Payments Failed: ‘Unauthorized’"

In browser console, For onsite woocommerce payment I got below info
success {"validationErrors":null,"exception":null,"response""type":"TokenResponse","token""dateCreated":1502304151773,"token":"MjRlZjRjZDMtNzRlNS00MWNjLWFlNTItYzg2MGQ5OWIwNWJj"},"paymentMethod""expMonth":"04","expYear":"2021","cardType":"VS","cardNum":"XXXX-XXXX-XXXX-555"},"errors":null}}

What should I do !!! , urgent guide requiured.

Start recurring billing after a period of time.

We don't want to store users credit card data but unable start recurring billing after some period of time without storing them.This is required especially for scenarios like when user downgrade his package new subscription must be started after users' unused package payment ends up.Will 2checkout support delayed recurring billing?

Authorization Failed

When I try to make payment below error occurred:
{"validationErrors":null,"response":null,"exception":{"httpStatus":"400","errorMsg":"Authorization Failed","exception":false,"errorCode":"600"}}

I don't know what is the issue because I have used the correct publishable key and privateKey with sellerId.

Tangible won't set up to 'Y'

Hello, I am not sure why but i cannot set tangible to 'Y' using sandbox mode.

image

Please, other lineItems data are set up and returned correctly, but only tangible are still at 'N'

Why is this happening ?

LineItems not in responce

I can get a the response to reflect all the items except the line items.

here's my code

$line_items = array(
  'type'        => 'product',
  'price'       => $this->amount,
  'product_id'  => $subscription->id,
  'name'        => $subscription->name,
  'quantity'    => '1',
  'tangible'    => 'N',
  'startup_fee' => $subscription->fee,
  'recurrence'  => $subscription->duration . ' ' . $subscription->duration_unit,
  'description' => $subscription->description,
);
try {
  $charge = Twocheckout_Charge::auth(array(
    'sid'                          => $this->seller_id,
    'mode'                         => '2CO',
    'merchantOrderId'              => $this->subscription_id,
    'token'                        => $_POST['twoCheckoutToken'],
    'currency'                     => strtolower( $this->currency ),
    'total'                        => $this->amount,
    'billingAddr'                  => array(
      'name'      => $_POST['rcp_card_name'],
      'addrLine1' => $_POST['rcp_card_address'],
      'city'      => $_POST['rcp_card_city'],
      'state'     => $_POST['rcp_card_state'],
      'zipCode'   => $_POST['rcp_card_zip'],
      'country'   => $_POST['rcp_card_country'],
      'email'     => $this->email,
    ),
    "lineItems" => array(
      $line_items
    )
  ));
}

every step of the way the lineItems are there, but just not on the response, and it doesn't show recurring in the sandbox dashboard

Translations

Is it possible to have i18n for this module. The module does not seem to have a .pot file. I have created one by using php makepot.php, but ı cannot have translations on website when I enter them using loco translate wordpress plugin.

2 Enhancements

2 Enhancements so far:

  1. If you don't use the class "Twocheckout_Charge", why loading it? I recommend using autoload_ register, ie:

""""
spl_autoload_register(function($X){switch($X){

case 'Twocheckout_Company': require(dirname(FILE) . '/Twocheckout/Api/TwocheckoutAccount.php');
case 'Twocheckout_Payment': require(dirname(FILE) . '/Twocheckout/Api/TwocheckoutPayment.php');
....
.....
.....
case '...'....
break;

}});
""""

This will provide performance since the class extensions are only loaded if the class is being called.

  1. Consider using singles quotes for text only: this

" form id="2checkout" action="https://www.2checkout.com/checkout/spurchase\" method="post" "

to this

.....' form id="2checkout" action="https://www.2checkout.com/checkout/spurchase" method="post" '.....

double quotes always checks variables inside, the single parses it directly.

I hope this was helpful. I'm new to both github and 2checkout. If I find anything else I'll tell you.

Note on Refunds

Note that if you want to do refunds, you must create a completely separate account. (A subaccount of your existing primary account will do.) When creating it, you must set API Access and API Update to true. Note that this account can be used for refunds, but this user cannot login to the dashboard like your primary user account can.

Failure to do this step will cause the API to report "Access Denied to API".

My commentary is that this is one more way that 2Checkout is still second-best to Stripe as far as developer friendliness. I mean, charges use API keys, but refunds do not, and require more hoops to jump through. Go figure.

Tag a new release

The last release was tagged more than 2 year ago, hover there're a list of commits in repository since that time. It's necessary to tag a new release-1.3

Twocheckout_Sale::stop Recurring item problem

In Twocheckoutsale.php

$lineitemData = Twocheckout_Util::getRecurringLineitems($result);
if (isset($lineitemData[0])) {
...
}

If recurring item is not the first line item,it throws "No recurring lineitems to stop".And in my situation array returned from getRecurringLineitems function has index starting from 1.Please replace this line with:

if (count($lineitemData)>0) {

}

how to save user token information ?

is there any token can i save from db, where has user will re purchase an item or subscription without the need of re entering credit card again?

Incorrect hash validation

Greetings,

I'm working on a plugin integration for Subrion CMS. Here is what I have now:

$form_values = array();

if ($iaCore->get('checkout_demo'))
{
    $form_values['demo'] = 'Y';
}

$form_values['sid'] = $iaCore->get('checkout_id');
$form_values['total'] = $plan['cost'];
$form_values['custom'] = $plan['title'];

$form_values['id_type'] = 1;
$form_values['cart_order_id'] = time();
$form_values['x_Receipt_Link_URL'] = IA_RETURN_URL . 'completed' . IA_URL_DELIMITER;
$form_values['id_account'] = iaUsers::hasIdentity() ? iaUsers::getIdentity()->id : 0;
$form_values['item_number'] = $plan['title'];
$form_values['vip'] = $_SERVER['REMOTE_ADDR'];

// print form values
if (isset($iaLog))
{
    $iaLog->logInfo('2checkout form values', $form_values);
}

// require 2co API library
require_once dirname(__FILE__) . '/lib/Twocheckout.php';

Twocheckout_Charge::redirect($form_values);

that's used to send the form data. I'm redirected to 2checkout and it seems I pass all the needed details there.

Here is the code to process response:

if (isset($_POST['item_number']) && !empty($_POST['item_number']))
{
    $params = array();
    foreach($_POST as $k => $v)
    {
        $params[$k] = $v;
    }

    if (isset($iaLog))
    {
        $iaLog->logInfo('2checkout $_POST response', $params);
    }

    // require 2co API library
    require_once dirname(__FILE__) . '/lib/Twocheckout.php';

    // validate response
    $result = Twocheckout_Return::check($params, $iaCore->get('checkout_secret'), 'array');

I always get incorrect hash. Even when I try to validate the data manually I see I get different hashes. What could be the case? Please advise!

Fatal error: Class 'Twocheckout_Charge' not found

Hello, I'm currently implementing yout API with PHP (Codeigniter), and I'm trying to send some data with:

Twocheckout_Charge::auth()

It seems that because of how this class its currently named vs the file name it wont load, I have to make a copy to my library folder and load that one.

This problem probably can be resolved by using namespaces, may be related to issue: #17

Sell already created product on https://sandbox.2checkout.com/sandbox/products/list_products

Is it possible to sell the product which is created on the dashboard of 2CO account?

  1. I have a product on 2CO with "product id" 12345 with all params: tangible, recur........
    Now I want to run just with this product id like "productId" =>"12345"
     $lineItems = array(
             "productId"  => "12345",
         );
       $query = array(
             "sellerId" => config('apikeys.twocheckout.seller_id'),
             "merchantOrderId" => "123465",
             "token" => $this->billing_data['token'],
             "currency" => self::CURRENCY,
             "billingAddr" => $billing_address,
             "lineItems" => array(  $lineItems    ),
     )

And I got error 400 in response

though
2. This example works fine.


          $lineItems = array(
               "productId"  => "2",
               "name"        => "Test Product",
               "quantity"    => "1",
               "tangible"    => "N",
               "startupFee" => "1.00",
               "recurrence"  => "1 Month",
               "description" => "This is a test",
               "price"=>"10.0"
           );

           $query = array(
               "sellerId" => config('apikeys.twocheckout.seller_id'),
               "merchantOrderId" => "123465",
               "token" => $this->billing_data['token'],
               "currency" => self::CURRENCY,
               "billingAddr" => $billing_address,
               "lineItems" => array(
                   $lineItems
               ),
           );

It would be nice if it is possible to sell created product from dashboard.
Thank you.

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.