Posting Payments in Wild Apricot using the generic API call

This is the first time that I am trying to post payments to invoices in Wild Apricot using the generic API module.

I’m hitting a roadblock and cannot see what my issue is, I’m getting an error when attempting to post a payment. The message is:
The operation failed with an error. Your request was invalid: . null

Here’s a look at the very basic setup used to test a post to an invoice. The first two modules work and return the appropriate data.

Here’s the body in the module:

Here’s the error I’m getting:

Thank you, Dan

Your JSON is invalid.

You can verify by copy-pasting the input bundle into https://jsonformatter.org

If you need further assistance, please provide the following:

  • Input bundle of your module

Please provide the input bundles of the modules by running the scenario (or get from the scenario History tab), then click the white speech bubble on the top-right of each module and select “Download input/output bundles”.
Screenshot_2023-10-06_141025

A.

Save each bundle contents in your text editor as a bundle.txt file, and upload it here into this discussion thread.

Uploading them here will look like this:

module-1-input-bundle.txt (12.3 KB)

B.

If you are unable to upload files on this forum, alternatively you can paste the formatted bundles in this manner:

  • Either add three backticks ``` before and after the code, like this:

    ```
    input/output bundle content goes here
    ```

  • Or use the format code button in the editor:
    Screenshot_2023-10-02_191027

Providing the input/output bundles will allow others to replicate what is going on in the scenario even if they do not use the external service.

This will allow others to better assist you. Thanks!

3 Likes

Thank you!

After looking at the code in json formatter, it took just a few seconds to figure out what was going wrong with my code.

What I did to get to the bottom of it, after getting a clue from the formatter, I just hard coded all the values in the code for the post. When I did that, the payment was successfully posted. I then methodically went through each variable, adding one at a time, testing the method each time till one failed.

It turned out that the URL variable from the previous module, 4.Url below, needed to be surrounded in double quotes. Once I made this change, it worked.

{
“Value”: 351.75,
“DocumentDate”: “2024-05-08”,
“Invoices”: [
{
“Id”: 4.Id,
“Url”: “4.Url”
}
],
“Contact”: {
“Id”: 4.Contact.Id,
“Url”: “4.Contact.Url”
},
“Tender”: {
“Id”: 2636311,
“Url”: “https://api.wildapricot.org/v2.2/accounts/###/Tenders/2636311
},
“Comment”: “Test Comment”,
“PublicComment”: “Test Public Comment”,
“PaymentType”: “InvoicePayment”
}

2 Likes

Hello there @DanSanders :wave:

Amazing to hear that you were able to get rid of your problem with assistance from @samliew! Thank you for posting here the final solution. We appreciate it. :rose: