Strip Pament Gateway error

When i am trying to use strip payment gateway i am getting this error.


D:\Projects\efashions\vendor\stripe\stripe-php\lib\ApiRequestor.php
  1. {
  2. $msg = isset($errorData['message']) ? $errorData['message'] : null;
  3. $param = isset($errorData['param']) ? $errorData['param'] : null;
  4. $code = isset($errorData['code']) ? $errorData['code'] : null;
  5. $type = isset($errorData['type']) ? $errorData['type'] : null;
  6. switch ($rcode) {
  7. case 400:
  8. // 'rate_limit' code is deprecated, but left here for backwards compatibility
  9. // for API versions earlier than 2015-09-08
  10. if ($code == 'rate_limit') {
  11. return new Error\RateLimit($msg, $param, $rcode, $rbody, $resp, $rheaders);
  12. }
  13. if ($type == 'idempotency_error') {
  14. return new Error\Idempotency($msg, $rcode, $rbody, $resp, $rheaders);
  15. }
  16. // intentional fall-through
  17. case 404:
  18. return new Error\InvalidRequest($msg, $param, $rcode, $rbody, $resp, $rheaders);
  19. case 401:
  20. return new Error\Authentication($msg, $rcode, $rbody, $resp, $rheaders);
  21. case 402:
  22. return new Error\Card($msg, $param, $code, $rcode, $rbody, $resp, $rheaders);
  23. case 403:
  24. return new Error\Permission($msg, $rcode, $rbody, $resp, $rheaders);
  25. case 429:
  26. return new Error\RateLimit($msg, $param, $rcode, $rbody, $resp, $rheaders);
  27. default:
  28. return new Error\Api($msg, $rcode, $rbody, $resp, $rheaders);
  29. }
  30. }
  31. /**
  32. * @static
  33. *
  34. * @param string|bool $rbody
  35. * @param int $rcode
  36. * @param array $rheaders
  37. * @param array $resp
Arguments
  1. "Must provide source or customer."

yousuf patel had replied 11 months ago

Even i am also looking for that, May be it is a JS error, This "source or customer" comes from below listed code

 jQuery('#stripe').bind('paymentProcessStart', function (e) {


                stripe.createToken(card).then(function (result) {

                    if (result.error) {

                        // Inform the customer that there was an error.

                        var errorElement = document.getElementById('card-errors');

                        errorElement.textContent = result.error.message;

                        jQuery("#place-order-button").prop('disabled', false);



                    } else {

                        // Send the token to your server.

                        stripeTokenHandler(result.token);

                        jQuery("#place-order-button").trigger('paymentProcessEnd');

                    }

                });


--------------------------------------------------------------------------------------------------

        function stripeTokenHandler(token) {

            // Insert the token ID into the form so it gets submitted to the server

            var formWrapper = document.getElementById('stripe-card-form-wrapper');

            var hiddenInput = document.createElement('input');

            hiddenInput.setAttribute('type', 'hidden');

            hiddenInput.setAttribute('name', 'stripeToken');

            hiddenInput.setAttribute('value', token.id);

            formWrapper.appendChild(hiddenInput);

        }


Hope, Purvesh will respond to this query.


 jQuery('#stripe').bind('paymentProcessStart', function (e) {
                stripe.createToken(card).then(function (result) {                    if (result.error) {                        // Inform the customer that there was an error.                        var errorElement = document.getElementById('card-errors');                        errorElement.textContent = result.error.message;                        jQuery("#place-order-button").prop('disabled', false);

                    } else {                        // Send the token to your server.                        stripeTokenHandler(result.token);                        jQuery("#place-order-button").trigger('paymentProcessEnd');                    }                });
--------------------------------------------------------------------------------------------------        function stripeTokenHandler(token) {            // Insert the token ID into the form so it gets submitted to the server            var formWrapper = document.getElementById('stripe-card-form-wrapper');            var hiddenInput = document.createElement('input');            hiddenInput.setAttribute('type', 'hidden');            hiddenInput.setAttribute('name', 'stripeToken');            hiddenInput.setAttribute('value', token.id);            formWrapper.appendChild(hiddenInput);        }
Hope, Purvesh will respond to this query." />

Purvesh had replied 11 months ago

One question 

In Admin have you setup you:

  • Payment Stripe Publishable Key:
  • Payment Stripe Secret Key

To me seems like the code is not getting the keys that it requires to process the payment.

thanks

Aaazan had replied 11 months ago

Yes, I ave setup the below keys, and i have enabled the strip payment gateway as well

1) Payment Stripe Publishable Key : pk_test_.......

2) Payment Stripe Secret Key :sk_test_c40LJF56sH........

And i have cross verified the values in payment.php file with configuration table

 const CONFIG_PUBLISHABLE_KEY    = 'payment_stripe_publishable_key';

 const CONFIG_SECRET_KEY         = 'avored_stripe_secret_key';

But, still same problem. 


Purvesh had replied 11 months ago

I will double check the bug and once it's been fixed I will let you know. most likes I fixed it over the weekend for sure. 

Purvesh had replied 11 months ago

Bug has been fixed: 

Please reinstalled it again to get the latest code or 

If you don't want to reinstall it again in that event try below download below file and replay it with the code:

https://github.com/avored/laravel-ecommerce/blob/master/themes/avored/default/views/checkout/index.blade.php

https://github.com/avored/laravel-ecommerce/blob/master/themes/avored/default/views/checkout/cards/payment-options.blade.php


Step 2: do `composer update`

    composer update

Thanks


I hope this above technique works for you.



Aaazan had replied 11 months ago

Hi Purvesh,

Thanks for your feedback. When i have changed the currency code from NZ to INR , i am getting this error page by clicking on the category tab in the front-end.


D:\Projects\avored1\vendor\avored\framework\src\Models\Database\Product.php
  1. return true;
  2. }
  3. return false;
  4. }
  5. public function getPriceAttribute($val)
  6. {
  7. $currentCurrencyCode = Session::get('currency_code');
  8. if(null === $currentCurrencyCode) {
  9. return $val;
  10. }
  11. $siteCurrency = App::get(SiteCurrencyInterface::class);
  12. $model = $siteCurrency->findByCode($currentCurrencyCode);
  13. return $val * $model->conversion_rate;
  14. }
  15. /**
  16. * Save Product Images.
  17. *
  18. * @param array $$data
  19. * @return \AvoRed\Framework\Models\Database\Product $this
  20. */
  21. public function saveProductImages(array $data):self
  22. {
  23. if (isset($data['image']) && count($data['image']) > 0) {
  24. $exitingIds = $this->images()->get()->pluck('id')->toArray();
  25. foreach ($data['image'] as $key => $data) {
  26. if (is_int($key)) {
  27. if (($findKey = array_search($key, $exitingIds)) !== false) {
  28. $productImage = ProductImage::findorfail($key);
  29. $productImage->update($data);
  30. unset($exitingIds[$findKey]);
Arguments
  1. "Trying to get property 'conversion_rate' of non-object (View: D:\Projects\avored1\themes\avored\default\views\product\view\product-card.blade.php) (View: D:\Projects\avored1\themes\avored\default\views\product\view\product-card.blade.php) 


 Is this supporting to indian currency or not ?


Thanks Aaazan .


 

 Is this supporting to indian currency or not ?
Thanks Aaazan .
 " />

Purvesh had replied 11 months ago

@aaazan I think what is the problem that you might have done is:

Login to Admin Panel => Currency Setup => Click Edit and changed it to INR. Instead of Adding a new Currency. (I have assumed that you have added a new currency). Try it and let me know that if that would fix your bug or not?