DocuSign Payments REST API create Tab

2019-08-21 10:06发布

问题:

I am trying to create a sample formula tab in my DocuSign envelope creation for requesting a payment (REST API). I have successfully created the signHere tabs for many of our products but I am now asked to create a tab where the recipient can sign first and then make a payment. The payment gateways are set up (and tested through the normal DocuSign Account GUI) so I do not think the issue lies there.

I am getting an "Error - Please enter a valid payment amount." once I attempt to finish... but there is no prompt for a payment amount...or way to enter any amount.

Looking for something that would be close to this format:

    "<formulaTabs>" +
      "<formulaTab>" +
       "<isPaymentAmount>true</isPaymentAmount><value>125.00</value>" +
       "<tabLabel>CDSetupFee</tabLabel><documentId>1</documentId> 
        <pageNumber>4</pageNumber>" +
       "<xPosition>200</xPosition><yPosition>630</yPosition>" +
      "</formulaTab>" +
    "</formulaTabs>" +

Any ideas?

回答1:

Formula Tab will give popup to the signer to fill the credit card/account details but on the document, nothing will be shown. So, they should use combination of Number Tab and Formula tab to show the amount on the document and get the card/account details using formula tab.

Complete JSON snippet will look like below:

Number Tab will show the Payment tab on the document, showing amount as 250 Dollars and then Formula Tab will take reference from the Number tab to calculate the total value to be shown to the customer as Popup to get credit card details.

In Formula tab, “amountReference” and “formula” is calculated using NumberTab reference.

"numberTabs": [{
    "xPosition": 268,
    "yPosition": 142,
    "documentId": "12345",
    "recipientId": "1",
    "pageNumber": 1,
    "value": 250,
    "maxLength": 4000,
    "width": 80,
    "height": 16,
    "tabLabel": "PaymentFixed 646b5192-a101-4cdc-a7e5-5e9bd1b80612",
    "paymentItemName": "Test Item Name",
    "paymentItemCode": "54321",
    "paymentItemDescription": "Test Item Details"
}],
"formulaTabs": [{
    "paymentDetails": {
        "currencyCode": "USD",
        "gatewayAccountId": "8cfb9a83-1f4c-40b1-b7a9-dd382ee0ca7d",
        "lineItems": [{
            "amountReference": "PaymentFixed 646b5192-a101-4cdc-a7e5-5e9bd1b80612",
            "name": "Test Item Name",
            "description": "Test Item Details",
            "itemCode": "54321"
        }]
    },
    "formula": "([PaymentFixed 646b5192-a101-4cdc-a7e5-5e9bd1b80612]) * 100",
    "recipientId": "1",
    "documentId": "12345",
    "tabLabel": "PaymentReceipt e47eed9a-85ca-4094-8d0f-50e51d5d1ee0",
    "xPosition": 0,
    "yPosition": 0,
    "pageNumber": 1,
    "required": true,
    "locked": true,
    "hidden": true
}]

isPaymentAmount has to be false if you are using our new PaymentsAPI with Stripe, Braintree and Authorize.Net.



回答2:

Amit K Bist gave me better direction with the json solution. After some trial and error I was able to use this help and come up with the following XML that looks to work for us. The syntax of XML needs to be perfect and is difficult to get right without example. Hope this example helps others too.

       "<numberTabs>" +
            "<number>" +
            //"<isPaymentAmount>true</isPaymentAmount>" +
            "<xPosition>200</xPosition><yPosition>630</yPosition>" +
            "<documentId>1</documentId>" +
            "<recipientId>1</recipientId>" +
            "<pageNumber>4</pageNumber>" +
            "<value>" + AdditionalDeposit + "</value>" +
            "<maxLength>4000</maxLength>" +
            "<width>80</width>" +
            "<height>16</height>" +
            "<tabLabel>PaymentLabel</tabLabel>" +
            "</number>" +
        "</numberTabs>" +

         "<formulaTabs>" +
            "<formulaTab>" +
            "<paymentDetails>" +
            "<allowedPaymentMethods><string>CreditCard,BankAccount</string>
             </allowedPaymentMethods>" +
            "<total><amountInBaseUnit>" + AdditionalDeposit + "
             </amountInBaseUnit><displayAmount>" + AdditionalDeposit + "
             </displayAmount></total>" +
            "<currencyCode>USD</currencyCode><gatewayAccountId>xxxx-xxxx-xxxx-xxxx-xxxx</gatewayAccountId><gatewayName>Stripe_8530</gatewayName>" +
            "<lineItems>" +
            "<paymentLineItem>" +
                 "<amountReference>PaymentLabel</amountReference>" +
                 "<description>CD Additional Deposit</description>" +
                 "<itemCode>PF54321</itemCode>" +
                 "<name>CD Additional Deposit</name>" +
            "</paymentLineItem>" +
            "</lineItems>" +
            "</paymentDetails>" +
            "<formula>([PaymentLabel]) * 100</formula>" +
            "<recipientId>1</recipientId>" +
            "<documentId>1</documentId>" +
            "<tabLabel>CDSetupFee</tabLabel>" +
            "<pageNumber>4</pageNumber><xPosition>0</xPosition>
             <yPosition>0</yPosition>" +
            "<required>true</required>" +
            "<locked>true</locked>" +
            "<hidden>true</hidden>" +
        "</formulaTab>" +
    "</formulaTabs>" +