Mangopay / mangopay2-php-sdk

PHP SDK for MANGOPAY
https://packagist.org/packages/mangopay/php-sdk-v2
MIT License
122 stars 133 forks source link

Problem creating a recurring pay. #533

Closed alfredobp closed 2 years ago

alfredobp commented 2 years ago

Hello, I am trying to create a recurring payment and I have problems when instantiating the class, it gives me this error:

MangoPay\Libraries\Exception PaymentDetails is not defined or it is not object type

And the code is:

$PayRecurrent = new \MangoPay\PayInRecurringRegistration();
      $PayRecurrent->AuthorId = Auth::user()->mangopay_id;
      $PayRecurrent->CardId = $CardRegistration->CardId;
      $PayRecurrent->CreditedWalletId = '11649975';
      $PayRecurrent->FirstTransactionDebitedFunds = session('amount') * 100;
      $PayRecurrent->FirstTransactionFees = 0;
      $PayRecurrent->PaymentDetails = 'Cargo';

      $result = $this->mangopay->PayIns->Create($PayRecurrent);

I think that the problem is in this line: $result = $this->mangopay->PayIns->Create($PayRecurrent);

I work with php SDK in laravel project. Thanks.

SoloJr commented 2 years ago

Hi. That's because you don't have to add PaymentDetails. There's an example in the tests with how you create a PayInRecurringRegistration. See here