invoiceninja / sdk-php

PHP wrapper for Invoice Ninja's REST API
https://www.invoiceninja.com
83 stars 41 forks source link

Assign payment to invoice #80

Closed Santukon closed 2 years ago

Santukon commented 2 years ago

Hello Team, Im using SDK version 0.5 and version v5.3.49 of Invoice ninja. I wonder how I can assign a payment to an invoice. Im able to create both independently, but not to relate them. resumming, I dont know how to fill paymenttables via the API. Can you give me a tip? Thank you!

turbo124 commented 2 years ago

@Santukon

Are you sure you are using 0.5 ? That is for v4, for v5 you'll want to use ^1

Santukon commented 2 years ago

Hello Turbo, Thank you for your fast response. Yes, as when I first did the integration 1.0 was not ready, but all works fine. Only problem I have is what I commented. Regards

turbo124 commented 2 years ago

@Santukon

here is an example

 $payments = $ninja->payments->create([
            'client_id' => $client['data']['id'], 
            'amount' => 10,
            'invoices' => [
                [
                'invoice_id' => $invoice['data']['id'],
                'amount' => 10
                ],
            ],
        ]);    

You can use the examples in the tests/ folder to see other implementations

Santukon commented 2 years ago

Awesome thank you!