Legacy Dev Forum Posts

 View Only

Sign Up

Nested Objects in Data Action Input

  • 1.  Nested Objects in Data Action Input

    Posted 06-05-2025 18:41

    Som_Akolkar | 2020-03-06 00:53:28 UTC | #1

    Hello,

    Checkout.com Payment API requires a nested object(source) in the request as below.

    { "source": { "type": "token", "token": "tok4gzeau5o2uqubbk6fufm7p54" }, "amount": 6540, "currency": "USD", "paymenttype": "Recurring", "reference": "ORD-5023-4E89", "description": "Set of 3 masks", }

    https://api-reference.checkout.com/#tag/Payments/paths/~1payments/post

    I cannot publish a Custom Data Action with a nested Object in the request. Is there a way of getting such a request to run in custom data action.

    Best Regards, Som.


    anon28885283 | 2020-03-06 01:41:43 UTC | #2

    You can modify the actual body request and form your objects in the requestTemplate (Configuration > Request Body Template).

    https://help.mypurecloud.com/articles/request-configuration-data-actions/


    Som_Akolkar | 2020-03-06 20:38:47 UTC | #3

    Hi,

    Do you have a working example of a transformation. The link you sent doesnt seem to have one.

    -Som


    anon28885283 | 2020-03-09 02:03:07 UTC | #4

    There actually is under "Example requestTemplate" albeit a simple one.

    Basically instead of the default ${input.rawRequest}, you design the JSON body that your API expects and use references to your input.

    Example:

    { "source": { "type": "token", "token": "${input.token}" }, "amount": "${input.amount}", ... } }


    Som_Akolkar | 2020-03-09 17:52:30 UTC | #5

    Thank you. The example you provided and the ones in documentation helped a lot.

    Best Regards, Som.


    system | 2020-04-09 17:52:33 UTC | #6

    This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.


    This post was migrated from the old Developer Forum.

    ref: 7281