cancel
Showing results for 
Search instead for 
Did you mean: 

smart button error on live site when paying with credit card

New Community Member

smart button error on live site when paying with credit card

Hi
I cannot find why I keep getting errors with the paypal button
Here my code:

 

<div id="paypal-button-container"></div>
    <script
      src="https://www.paypal.com/sdk/js?client-id=production_client_id&currency=EUR"
      data-sdk-integration-source="button-factory"></script>
    <script>
    paypal.Buttons({
      style: {
        shape: 'rect',
        color: 'silver',
        layout: 'vertical',
        label: 'paypal',

      },
      createOrder: function(data, actions) {
        return actions.order.create({
          purchase_units: [{
            amount: {
              value: '1'
            }
          }]
        });
      },
      onApprove: function(data, actions) {
        return actions.order.capture().then(function(details) {
          alert('Transaction completed by ' + details.payer.name.given_name + '!');
        });
      }
    }).render('#paypal-button-container');
    </script>

 

and the response is:

 

{
  "errors": [
    {
      "data": {
        "payer": {
          "id": "7V8S___WXN",
          "email": "XXXXXXX",
          "phone": "+972 XXXXXXXXXX",
          "phone_type": "MOBILE",
          "user_type": "GUEST"
        },
        "state": "NON_PAYABLE",
        "shipping": {
          "id"[Removed. Phone #s not permitted],
          "name": "XXX",
          "line1": "XXX",
          "city": "XXX",
          "state": "",
          "country": "IL",
          "postal_code": "42000",
          "normalization_status": "UNKNOWN",
          "preferred_address": true,
          "default": true,
          "s2s_address": false,
          "full_address": "XXXXXXXXX",
          "full_address_multiline": [
            "XXXXXXXX",
            "XXXXXXX"
          ]
        },
        "fundingOptions": {
          "disallowedInstruments": [
            {
              "type": "CARD",
              "id": "CC-P72L____ZP8",
              "name": "VISA",
              "lastDigits": "xxxx",
              "isPinlessDebit": false,
              "isPreferred": true,
              "isBillingPreferred": false,
              "productClass": "CREDIT",
              "expire_year": "2021",
              "expire_month": "05",
              "partial_fpan": false,
              "declineReason": "unsupportedGeneric",
              "displayName": "Visa"
            }
          ]
        },
        "bmlOffer": 0,
        "installments": null,
        "sepa_mandate": null,
        "resolve_3ds": null,
        "unconfirmed_upop": null,
        "isCreditDisallowedForMerchant": false,
        "errorData": {},
        "cvvData": null,
        "negBals": null,
        "origContName": null,
        "showRemittanceDisclosure": null,
        "threeDSResolutionData": null,
        "threeDSPayerAction": null,
        "payerConsentResolutionData": null,
        "realTimeBalanceResolutionData": null
      },
      "message": "NEED_CREDIT_CARD",
      "path": [
        "approveGuestPaymentWithCreditCard"
      ],
      "stack": "Error: NEED_CREDIT_CARD\n    at /dependencies/xobuyernodeserv/cronus/scripts/node_modules/xo-hermes-checkout/src/apis/session/index.js:314:39\n    at /dependencies/xobuyernodeserv/cronus/scripts/node_modules/app-shims/lib/promise-checkpoints.js:107:51\n    at bound (domain.js:402:14)\n    at runBound (domain.js:415:12)\n    at tryCatcher (/dependencies/xobuyernodeserv/cronus/scripts/node_modules/xo-shim-promise/node_modules/bluebird/js/release/util.js:16:23)\n    at Promise._settlePromiseFromHandler (/dependencies/xobuyernodeserv/cronus/scripts/node_modules/xo-shim-promise/node_modules/bluebird/js/release/promise.js:547:31)\n    at Promise._settlePromise (/dependencies/xobuyernodeserv/cronus/scripts/node_modules/xo-shim-promise/node_modules/bluebird/js/release/promise.js:604:18)\n    at Promise._settlePromise0 (/dependencies/xobuyernodeserv/cronus/scripts/node_modules/xo-shim-promise/node_modules/bluebird/js/release/promise.js:649:10)\n    at Promise._settlePromises (/dependencies/xobuyernodeserv/cronus/scripts/node_modules/xo-shim-promise/node_modules/bluebird/js/release/promise.js:725:18)\n    at _drainQueueStep (/dependencies/xobuyernodeserv/cronus/scripts/node_modules/xo-shim-promise/node_modules/bluebird/js/release/async.js:93:12)\n    at _drainQueue (/dependencies/xobuyernodeserv/cronus/scripts/node_modules/xo-shim-promise/node_modules/bluebird/js/release/async.js:86:9)\n    at Async._drainQueues (/dependencies/xobuyernodeserv/cronus/scripts/node_modules/xo-shim-promise/node_modules/bluebird/js/release/async.js:102:5)\n    at Immediate.Async.drainQueues (/dependencies/xobuyernodeserv/cronus/scripts/node_modules/xo-shim-promise/node_modules/bluebird/js/release/async.js:15:14)\n    at Immediate._onImmediate (/dependencies/xobuyernodeserv/cronus/scripts/node_modules/async-listener/glue.js:188:31)\n    at runCallback (timers.js:720:18)\n    at tryOnImmediate (timers.js:691:5)\n    at processImmediate (timers.js:673:5)\n    at process.topLevelDomainCallback (domain.js:126:23)",
      "checkpoints": [
        "createCheckoutSession"
      ],
      "meta": {},
      "errorData": {
        "resolution": {
          "name": "ADD_PAYMENT_CARD",
          "data": {
            "fi": {},
            "billing_address": {
              "line1": "XXXXXX",
              "line2": "",
              "city": "XXXXX",
              "postal_code": "42000",
              "state": "",
              "country_code": "IL"
            }
          }
        },
        "cause": "NO_VALID_FUNDING_INSTRUMENT",
        "step_up_context": {}
      },
      "contingency": true,
      "statusCode": 200
    }
  ],
  "data": {
    "approveGuestPaymentWithCreditCard": null
  },
  "extensions": {
    "correlationId": "dc1c____834d0"
  }
}

 

As you can see there is a (valid) credit card but still have ''Error: NEED_CREDIT_CARD"
Any Ideas?

thanks