Bonjour,
j'ai mis sur pied un sytème de payement par paypal sur mon site cela fonctionne bien mais pour certains type de valeurs

Ce que je fais

Décrivez ici votre code ou ce que vous cherchez à faire

E     $apiContext = new \PayPal\Rest\ApiContext(new \PayPal\Auth\OAuthTokenCredential(clientID,secretCode));

            $prixtotal = 1000000;
            $sousTotal = 15000;
            $sup = 15000;
          $list = new \PayPal\Api\ItemList();

          $item = (new \PayPal\Api\Item())
                    ->setName("Souscription pack")
                    ->setPrice(ceil($sousTotal))
                    ->setCurrency("USD")
                    ->setQuantity(1);
           $list->addItem($item);

          $item = (new \PayPal\Api\Item())
                    ->setName(__("Frais création de compte"))
                    ->setPrice($sub)
                    ->setCurrency("USD")
                    ->setQuantity(1);
            $list->addItem($item);

          $details = (new \PayPal\Api\Details())
                          ->setSubtotal(ceil($prixtotal));

          $amount = (new \PayPal\Api\Amount())
                          ->setTotal(ceil($prixtotal))
                          ->setCurrency("USD")
                          ->setDetails($details);

          $transaction = (new \PayPal\Api\Transaction())
                          ->setItemList($list)
                          ->setDescription("Achat sur le site NUFISMS")
                          ->setAmount($amount)
                          ->setCustom("Premier-payement-paypal");

          $payement = new \PayPal\Api\Payment();

          $payement->setTransactions([$transaction]);

          $payement->setIntent('sale');
          $redirectUrls = (new \PayPal\Api\RedirectUrls())
                    ->setReturnUrl('http://localhost/website/index')
                    ->setCancelUrl('http://localhost/website/comptes/index');

          $payement->setRedirectUrls($redirectUrls);
          $payement->setPayer((new \PayPal\Api\Payer())->setPaymentMethod('paypal'));
          try {
                $payement->create($apiContext);
               header('Location:' . $payement->getApprovalLink());
          } catch (\PayPal\Exception\PayPalConnectionException $e) {

              var_dump(json_decode($e->getData()));

          }

Ce que je veux

si je passe par exemple les valeurs $prixtotal = 96686765 j'aurai un message d'erreur

Ce que j'obtiens

object(stdClass)[243]
  public 'name' => string 'VALIDATION_ERROR' (length=16)
  public 'details' => 
    array (size=6)
      0 => 
        object(stdClass)[292]
          public 'field' => string 'transactions[0].amount.total.value' (length=34)
          public 'issue' => string 'Value too long (max length 10)' (length=30)
      1 => 
        object(stdClass)[281]
          public 'field' => string 'transactions[0].item_list.items[0].price.value' (length=46)
          public 'issue' => string 'Value too long (max length 10)' (length=30)
      2 => 
        object(stdClass)[288]
          public 'field' => string 'transactions[0].amount.details.subtotal' (length=39)
          public 'issue' => string 'Currency amount must be non-negative number, contain exactly 2 decimal places separated by '.' (JPY contains 0 decimal places), optional thousands separator ',', limited to 7 digits before the decimal point and currency which is a valid ISO Currency Code' (length=254)
      3 => 
        object(stdClass)[290]
          public 'field' => string 'transactions[0].item_list.items[0].price' (length=40)
          public 'issue' => string 'Currency amount must be non-negative number, contain exactly 2 decimal places separated by '.' (JPY contains 0 decimal places), optional thousands separator ',', limited to 7 digits before the decimal point and currency which is a valid ISO Currency Code' (length=254)
      4 => 
        object(stdClass)[291]
          public 'field' => string 'transactions[0].amount.total' (length=28)
          public 'issue' => string 'Currency amount must be non-negative number, contain exactly 2 decimal places separated by '.' (JPY contains 0 decimal places), optional thousands separator ',', limited to 7 digits before the decimal point and currency which is a valid ISO Currency Code' (length=254)
      5 => 
        object(stdClass)[294]
          public 'field' => string 'transactions[0].amount.details.subtotal.value' (length=45)
          public 'issue' => string 'Value too long (max length 10)' (length=30)
  public 'message' => string 'Invalid request - see details' (length=29)
  public 'information_link' => string 'https://developer.paypal.com/docs/api/payments/#errors' (length=54)
  public 'debug_id' => string '49a498727ea42' (length=13)

je constate pour certains valeurs énorme l'api ne supporte pas la transaction par contre pour des petites valeurs, cela fonctionne correctement. Quelqu'un a déjà rencontré ce problème?

Aucune réponse