I am creating an envelope from a template (which I have created using Docusign website UI) with a second signer which the envelope will be emailed to after the first signer is finished, but I want to be able to pause and unpause this through the API. The process works as designed without the added workflow_step, but returns an error with the workflow_step added.
envelope_definition = DocuSign_eSign::EnvelopeDefinition.new({
status: 'sent',
templateId: template_id
})
signer1 = DocuSign_eSign::TemplateRole.new({
email: signer1_email,
name: signer1_name,
roleName: 'signer1',
clientUserId: signer_client_id,
recipientId: 1,
routingOrder: 1
})
signer2 = DocuSign_eSign::TemplateRole.new({
email: signer2_email,
name: signer2_name,
roleName: 'signer2',
recipientId: 2,
routingOrder: 2
})
envelope_definition.template_roles = [signer1, signer2]
workflow_step = DocuSign_eSign::WorkflowStep.new(
action: 'pause_before',
triggerOnItem: 'routing_order',
itemId: 2
)
workflow = DocuSign_eSign::Workflow.new(workflowSteps: [workflow_step])
envelope_definition.workflow = workflow
Any idea what I am doing wrong?
If you can't add workflow steps to an envelope created from a template, can I add it to the template somehow?
Unfortunately this is a bug. Please ask your DocuSign support contact to add your company's information to internal bug report ARR-586.
Workaround
This workaround was reported to work:
Create an envelope that uses the template and set the template roles. But set the status to created. This will create a draft envelope.
Use the EnvelopeWorkflows:update API method to add the workflow.
{
"workflowSteps": [
{
"action": "pause_before",
"triggerOnItem": "routing_order",
"itemId": 2
}
]
}
Use the Envelopes:update method to change the status to sent
Please add a comment to this answer if this technique worked for you.
Related
I've managed to create a checkout page with promotion code like this
const sessionParams: Stripe.Checkout.SessionCreateParams = {
customer_email: user.email,
mode: 'subscription',
line_items: [
{
price: process.env.STRIPE_PRICE_CODE,
quantity: 1,
},
],
metadata: {
userId: user.userId,
},
// {CHECKOUT_SESSION_ID} is a string literal; do not change it!
// the actual Session ID is returned in the query parameter when your customer
// is redirected to the success page.
success_url: `${origin}/account/download-app?session_id={CHECKOUT_SESSION_ID}`,
cancel_url: `${origin}/account/plan-preview`,
};
if (req.query.coupon === 'special-access') {
sessionParams.allow_promotion_codes = true;
} else {
sessionParams.discounts = [{ promotion_code: '***' }];
}
const session = await stripe.checkout.sessions.create(sessionParams);
But I've noticed that user can't remove the promo code and add his custom code.
I see other companies checkouts that they do have prefilled promo code with an X to remove it and add their own
I've tried using discount object with allow_promotion_codes: true, but it seems not allowed by the API.
Checkout does not currently support pre-filling a promotion code that can be removed by the customer on the payment page. Equally, you cannot pass both the allow_promotions_code parameter and pre-fill a promotion code via the discounts hash. The API will error (as you've discovered). In order for the promotion code to be removable by your customer, you will need to only use the allow_promotion_codes boolean.
Payment Links do support pre-filling of promotion codes via the URL parameter (e.g. https://buy.stripe.com/foo?prefilled_promo_code=bar), which is likely what you're referencing.
I'm trying to create an envelope. My flow is next:
Obtaining OAuth token
Creating envelope based on existing template
Using createRecipientView method to get redirect url for the first signer(Later I'm taking the existing envelope id and creating redirect url for the second signer)
The problem:
It works as I expect if only signer's email address belongs to my docusign developer account. In other words if it is in the list of my docusign dev account users. Otherwise, with any random email address, I'm being redirected to the document page but I'm only able to view it and close, there's no start->sign->finish button(I'm not able to sign a doc).
One thing I've noticed is the wrong recipientId which is equal to zeros and dashes(normally it has a set of numbers and letters). I find it at a signing page -> other actions -> Session Information. It's hapenning when I'm being redirected as a user with any email(one that does not belong to docusign account). BUT, every signer receives an email notification with the same link to the document and If I go from that link, I can sign a document no matter what email address it is.
Session information with the wrong recipientId
My code:
const client = new docusign.ApiClient()
client.setBasePath('https://demo.docusign.net/restapi')
client.setOAuthBasePath('account-d.docusign.com')
const tokenResponse = await client.requestJWTUserToken(userId, integrationKey, ['impersonation', 'signature'], privateKey, 600)
client.addDefaultHeader('Authorization', `Bearer ` + tokenResponse.body.access_token)
const envelopesApi = await new docusign.EnvelopesApi(client)
const envelope = await envelopesApi.createEnvelope(accountId, {
envelopeDefinition: {
templateId: templateId,
status: 'sent',
emailSubject: `Signing template ID: ${templateId}`,
templateRoles: [
{ roleName: args.firstRole, name: args.firstSignerName, email: args.firstSignerEmail },
{ roleName: args.secondRole, name: args.secondSignerName, email: args.secondSignerEmail },
],
}
})
const recipientView = await envelopesApi.createRecipientView(accountId, envelope.envelopeId, {
recipientViewRequest: {
returnUrl: my local host,
email: args.firstSignerEmail,
userName: args.firstSignerName,
authenticationMethod: 'none',
},
})
return recipientView
Please, let me know If you know what I'm doing wrong.
I read docusign docs and thought I'm missing some permission, but so far can't figure out what's the problem
I could be wrong but based on your description, you haven't set up a clientUserId parameter for your recipients. Recipient Views are created for embedded signers wherein you embed the signing session into your own application. As embedded recipients are a special class of recipients associated only with the sender's account, this could explain why your recipient view works for users already part of your account but does not work for anyone else.
We are using the Node.js DoucSign SDK to send out docs for signatures. Currently, we are getting the RECIPIENTS_NOT_PROVIDED error when we try to send it via our CRM. Our CRM calls our API when a a status is changed which should send the docs. In our Graphql API Playground we are able to successfully create and send the envelope with no issue. I am sure I am missing something but I just can't see it. Any help would be greatly appreciated!
let signer1 = docusign.TemplateRole.constructFromObject({
email: args.signorEmail,
name: `${args.signorLegalName}`,
tabs: signerTabs,
roleName: 'signer',
recipientId: '1'
});
let cc1 = docusign.TemplateRole.constructFromObject({
email: !!args.ccEmail,
name: !!args.ccName,
tabs: ccTabs,
roleName: 'signer',
recipientId: '2'
});
// Add the TemplateRole objects to the envelope object
env.templateRoles = [signer1, cc1];
env.status = 'sent';
Here is our successful template roles via our playground:
"[{"email":"signorEmail",
"name":"Jane Doe",
"roleName":"signer",
"tabs":{"signHereTabs":[{"anchorString":"{{Signature_1}}"}],
"textTabs":[Removed Tabs]}},
{"email": "ccEmail",
"name":"John Smith",
"roleName":"cc",
"tabs":{"signHereTabs":[{"anchorString":"{{Signature_2}}"}],"textTabs":[removed Tabs]
}}]"
Unsuccessful:
"[{"email": "signorEmail",
"name":"Test 1",
"roleName":"signer",
"tabs":{"signHereTabs":[{"anchorString":"{{Signature_1}}"}],
"textTabs":[Removed Tabs]}},
{"email": "ccEmail",
"name":"John Smith",
"roleName":"cc",
"tabs":{"signHereTabs":[{"anchorString":"{{Signature_2}}"}],"textTabs":[removed Tabs]
}}]"
Well,
First, I see two recipients with the same roleName ('signer') which suggest to me one of them is wrong. RoleNames should be unique inside the same template.
In terms of why the first JSON is ok and the second is not, they seem to be the same except that the second is not valid JSON at all. Just use any JSON validator and check out some missing brackets etc.
I am new with Stripe API and I want to create a Subscription per month with letting the possibility to enter a discount code if they want to.
For that, I use Subscription Schedule which allows me to create 2 phases inside. The first one would be, for example, the first week for 1€ and then the regular subscription.
Everything works well and I'm able to create the Subscription Schedule:
{
canceled_at: null
completed_at: null
created: 1602415626
current_phase: {end_date: 1602502026, start_date: 1602415626}
customer: "cus_IAzNj2kr9i1nw8"
default_settings: {billing_cycle_anchor: "automatic", billing_thresholds: null,
collection_method: "charge_automatically", default_payment_method: null, default_source: null,
…}
end_behavior: "release"
id: "sub_sched_1Hb2hiLShhG4xDx2Fw5Xn3mg"
livemode: false
metadata: {user_id: "263175", promo_code: "", sub_id_id: "11"}
object: "subscription_schedule"
phases: (2) [{…}, {…}]
released_at: null
released_subscription: null
renewal_interval: null
status: "active",
subscription: "sub_IBPWnRqS6gVVlm"
}
The only issue I'm facing is how to validate my user's cards with Subscription Schedule? When you create a regular Subscription you can have access to either pending_setup_intent or last_invoice.payment_intent, from which you can either ask 3DS or send an error message.
Can you guys tell me how I can achieve that?
Thank you
You'd need to retrieve the Subscription by its ID to get those, but then you should have access to them.
How do I change the following code to get email notifications and send signed copy via email?
let customer = {
email: app.application.email,
// clientUserId: app.application.email, // added when they request embedded signing
name: "name",
roleName: 'customer',
tabs: tabs,
// recipientId: '1',
// routingOrder: '1'
}
if (payload.customerSignMethod == 'Embed') {
customer.clientUserId = app.application.email;
}
signers.push(
docusign.TemplateRole.constructFromObject(customer)
);
envelope.templateRoles = signers;
envelope.status = "sent";
the commented line is the key:
// clientUserId: 'cvbcvb#cvbcvb.com', // added when they request embedded signing
The way you had it, it should send email out to recipients, for remote signing.
If you put this line back in - it won't as it will be used for embedded signing.
If you have it commented, and still don't see the email, there's another issue.
Did you change the envelope status to "sent"? that should be done to actually send it.