How do I programmatically set the payment_options?

How do I programmatically set the payment_options?

Here is the value of payment_options/payment gateway json from a manually created invoice. The payment options works. 

What is the syntax to set these programatically?

  1. "payment_options": {
  2.             "payment_gateways": [
  3.                 "{\"configured\":true,\"can_show_billing_address\":false,\"additional_field1\":\"standard\",\"is_bank_account_applicable\":false,\"can_pay_using_new_card\":true,\"gateway_name\":\"paypal\"}",
  4.                 "{\"configured\":true,\"can_show_billing_address\":false,\"is_bank_account_applicable\":false,\"can_pay_using_new_card\":true,\"gateway_name\":\"payments_pro\"}"
  5.             ]
  6.         },

Here's my code:

  1. invoice.put("customer_id",customerid);
  2. invoice.put("zcrm_potential_id",deal_id);
  3. invoice.put("date",today);
  4. invoice.put("line_items",invoice_line_item);
  5. invoice_custom_fields_list = List();
  6. invoice_custom_fields_map = Map();
  7. invoice_custom_fields_map.put("api_name","cf_estimated_ship_date");
  8. invoice_custom_fields_map.put("value",zoho.currentdate.addWeek(production_weeks));
  9. invoice_custom_fields_list.add(invoice_custom_fields_map);
  10. invoice.put("custom_fields",invoice_custom_fields_list);
  11. params = Map();
  12. params.put("JSONString",invoice);
  13. if(create_invoice == true)
  14. {
  15. response = invokeurl
  16. [
  17. url :"https://books.zoho.com/api/v3/invoices?organization_id=" + books_organization_ID
  18. type :POST
  19. parameters:params
  20. connection:"books_invoices_create"
  21. ];
  22. info response;
  23. invoice_id = response.get("id");
  24. // End Create Invoice in Books
  25. // Attach Invoice Final pdf
  26. url = "https://invoice.zoho.com/api/v3/invoices/" + invoice_id + "/attachment";
  27. }