ExpressCheckout with recurring payments -- Cannot find solution - payment

I have been trying to set up an ExpressCheckout with recurring payments but I don't find the solution.
Having a look at the documentation (Recurring Payments With the Express Checkout API), the diagram gives a sequence where "CreateRecurringPaymentsProfile" is invoked at the end.
Now, having a look at the other documentation (How to Create a Recurring Payments Profile with Express Checkout), the different steps which are explained give a different sequence order, where "CreateRecurringPaymentsProfile" comes directly after "GetExpressCheckoutDetails".
I tried to follow this second example but I systematically receive an error.
Could someone tell me what I exactly need to do?
Of course a practical example would be more than welcome...
In advance, many thanks
Additional information:
The error I am receiving is "INVALID TOKEN".
Here is the information I send:
VERSION=84.0
METHOD=CreateRecurringPaymentsProfile
LOCALECODE=FR
TOKEN=[the one I received from SetExpressCheckout]
PROFILESTARTDATE=[the date of the next payment]
BILLINGPERIOD=Month
BILLINGFREQUENCY=6
TOTALBILLINGCYCLES=0
AMT=[the same as I mentioned in PAYMENTREQUEST_0_AMT]
AUTOBILLAMT=AddToNextBilling
CURRENCYCODE=EUR
MAXFAILEDPAYMENTS=3
DESC=[the same as I mentioned in L_BILLINGAGREEMENTDESCRIPTION0]
L_PAYMENTREQUEST_0_NAME0=[the same as I used in SetExpressCheckout]
L_PAYMENTREQUEST_0_DESC0=[the same as I used in SetExpressCheckout]
L_PAYMENTREQUEST_0_AMT0=[the same as I used in SetExpressCheckout]
L_PAYMENTREQUEST_0_QTY0=[the same as I used in SetExpressCheckout]
L_PAYMENTREQUEST_0_TAXAMT0=[the same as I used in SetExpressCheckout]
Do I also need to mention:
L_BILLINGAGREEMENTDESCRIPTION0 & L_BILLINGTYPE0 ?

In case you get 11502 Invalid token, you will need to pass the following variables in your SetEC API request:
BILLINGAGREEMENTDESCRIPTION=Your billing agreement name
BILLINGTYPE=RecurringPayments
Please, check below how EC+RP flow works:
1) SetExpressChekout + BILLINGAGREEMENTDESCRIPTION and BILLINGTYPE variables
VERSION = 86.0
METHOD = SetExpressCheckout
RETURNURL =
http://www.website.com/return.php
CANCELURL =
http://www.website.com/cancel.php
PAYMENTREQUEST_0_CURRENCYCODE =
USD
PAYMENTREQUEST_0_PAYMENTACTION = SALE
L_BILLINGTYPE0 =
RecurringPayments
L_BILLINGAGREEMENTDESCRIPTION0 = SameEveryTime
PAYMENTREQUEST_0_AMT = 1.00
PAYMENTREQUEST_0_ITEMAMT = 1.00
PAYMENTREQUEST_0_DESC = Labs
L_PAYMENTREQUEST_0_NAME0 = Lab 1
L_PAYMENTREQUEST_0_NUMBER0 = 10101
L_PAYMENTREQUEST_0_QTY0 = 1
L_PAYMENTREQUEST_0_AMT0 = 1.00
L_PAYMENTREQUEST_0_DESC0 = Download
2) Login into your PayPal account and click on “Accept and Continue”
https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=EC-2EJ022116H3067544
Buyer logs into his PayPal account and click on the button “Agree and Continue”,
then he will be redirect to RETURNURL+ token+ PayerID:
http://www.website.com/return.php?token=EC-2EJ022116H3067544&PayerID=HHHAPCFUM9ULW
3) Then you can run CreateRecurringPaymentsProfile + token:
PROFILEREFERENCE=RPInvoice123
PROFILESTARTDATE=2016-08-17T14:30:00Z
SUBSCRIBERNAME=Mr Sub Scriber
METHOD=CreateRecurringPaymentsProfile
TOKEN=XXXXXXXXXXXXX
DESC=SameEveryTime
AMT = 1.00
BILLINGPERIOD=Day
BILLINGFREQUENCY=3
VERSION=86.0
MAXFAILEDPAYMENTS=1
L_PAYMENTREQUEST_0_AMT0=1.00
L_PAYMENTREQUEST_0_NAME0=Lab 1
L_PAYMENTREQUEST_0_NUMBER0=10101
L_PAYMENTREQUEST_0_QTY0=1
L_BILLINGTYPE0=RecurringPayments
L_BILLINGAGREEMENTDESCRIPTION0=SameEveryTime
L_PAYMENTREQUEST_0_ITEMCATEGORY0=Digital
and this is the NVP Response:
PROFILEID=I-TOKEN123456
PROFILESTATUS=ActiveProfile
TIMESTAMP=2013-11-22T04:06:50Z
CORRELATIONID=2b5be15a871ff
ACK=Success
VERSION=86.0
BUILD=5908853
Documentation:
ECRecurringPayments
API references (NVP)
SetExpressCheckout API request
CreateRecurringPayment API request

Related

Google Form Search and Pull Spreadsheet Data

Hi I have google spreadsheet that contains customers' ID and their shipping status. I want to create google form where customers are able to input each of their own ID, with the return that the google form shows their shipping status.
I tried to look for solutions in internet but there was no luck. I am not really good in programming, i hope there is answer to this problem without having me to do some hard programming.
The sample case can be seen in here: https://docs.google.com/spreadsheets/d/14vSAeZxEJTzbNLLYEiref6qt-CMqiVi8alheLcIBugM/edit?usp=sharing
Google form should show something a little bit like is shown in cell D1:E3.
Where customers can fill the form with their own customer id, and the google form shows the status.
Consideration
There is no way to respond back in a Google Form directly. You can't show custom validation messages after From submission either.
Proposed solution
What about using email addresses additionally to the customerID to retrieve the shipping status? In this way you can easily build a notification system that will send an email if a matching customer ID is found in your spreadsheet.
To build such system you will have to build a Form with a Trigger.
It is required a bit of programming but I will try to cover the most important parts the best I can:
Adapt your Database structure
Add the customers email addresses in the column C in order to be able to retrieve it using the same customer ID.
| A | B | C |
|----+--------+-------|
| ID | STATUS | EMAIL |
Build the Form Trigger
In the Form you are using click on the 3 dots from the top menu and select Script Editor. Here you will write the code that will power your notification system.
function installTrigger() {
// This function instructs the program to trigger the checkID function whenever a form response is submitted
ScriptApp.newTrigger('checkID')
.forForm(FormApp.getActiveForm())
.onFormSubmit()
.create();
}
function checkID(e) {
// This function will parse the response to use the customer ID to retrieve email address and shipping status from the Spreadsheet Database
var responses = e.response.getItemResponses(); // Gets the form responses
var id = responses[0].getResponse(); // Assuming the first answer (index 0) is the customer ID)
var found = SpreadsheetApp.openById('spreadsheet_id')
.getRange('Sheet1!A1:C8') // The spreadsheet cells range in A1 Notation
.getValues() // Retrieve their values in rows
.filter((row) => row[0] == id); // Filter the rows for the provided customer ID
if (found) {
var status = found[0][1]; //Column B
var email = found[0][2]; //Column C
var subject = "Shipping Status";
var message =
`Hello!
The status of the order number ${id} is: ${status}.`
MailApp.sendEmail(email, subject, message);
}
}
Install the trigger
From the Script Editor top menu run the installTrigger() function: Run>Run function>installTrigger.
You are done
Following these steps you have successfully set up the notification system. Now you can start sharing the Form link and accept responses.
References
Installable Triggers
Mail App

Docusign Authentication

I have just started reading up docusign and have to implement it in my project using PHP. The requirement being, once user accepts the offer, he is directed to the document for signing. I understood the template and envelop creation but am stuck at the first step of authorization. I used the Legacy Header Authentication which is easy and works. But they are discouraging using this method anymore. So what to do instead of this?
Thanks in advance.
Is your application used to send out the request for signing?
If so, then the user of your application should probably have their own account on DocuSign. You should use OAuth authorization code grant to let your app's user login and send out the signing request.
For example, an employee uses your app to send out offer letters. In this case, your employee would authenticate himself to DocuSign via your app using OAuth Authorization Code Grant.
Or is the user of your application the signer who will be agreeing to something via DocuSign? If so then your app needs to create an envelope to be signed by the signer. Since the user of your application in this case is not a member of your company/organization, you need your app to impersonate someone who is a member of your org.
In this case, your app can use JWT authentication with impersonation to act on behalf of someone.
For example, your application is used by potential new employees to agree to the offered employment contract. In this case, the user of your app (the new employee) doesn't have a DocuSign login. So your app impersonates (using the JWT flow) an HR person in your company. Your app then, on behalf of the HR person, enables the new employee to sign the offer letter or generate new letter that will be sent for signing via DocuSign.
If JWT authentication fits your user case, we have a code example for PHP. See https://github.com/docusign/eg-01-php-jwt
We also have an Authorization code grant example for PHP.
I tried "rolling my own" JWT authentication, but gave up. I have found that Chilkat (chilkatsoft.com) works well:
Function Authenticate(SenderEmail2 As String) As Boolean
'MsgBox("AuthToDocuSign.Authenticate()") 'IHF 04/28/22
Authenticate = False
Dim oauth2 As New Chilkat.OAuth2
Dim success As Boolean
ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3 Or SecurityProtocolType.Tls Or SecurityProtocolType.Tls11 Or SecurityProtocolType.Tls12 'IHF 05/01/22
' This should be the port in the localhost Redirect URI for your app defined in the Docusign developer portal.
' The Redirect URI would look like "http://localhost:3017/" if the port number is 3017.
oauth2.ListenPort = 8080
' For developer sandbox environment, authorization endpoint is https://account-d.docusign.com/oauth/auth
' For production platform, authorization endpoint is https://account.docusign.com/oauth/auth
oauth2.AuthorizationEndpoint = "https://account.docusign.com/oauth/auth"
oauth2.TokenEndpoint = "https://account.docusign.com/oauth/token"
oauth2.ClientId = "c55048e7-fae1-4ad1-b223-258fce040f57" 'PROD. Also known as Integration Key
' This is your secret key for the authorization code grant.
oauth2.ClientSecret = "f1ddad37-a731-44b1-9679-e7f4268ec4a2" 'PROD. Also known as Secret Key [Fix 04/28/22] ?
oauth2.Scope = "signature"
'oauth2.Scope = "signature impersonation" 'IHF 02/14/22
oauth2.RedirectAllowHtml = "<html><head><meta http-equiv='refresh' content='0;url=https://app.docusign.com'></head><body>Thank you for allowing access.</body></html>" 'PROD. appdemo.docusign.com in DEV
' Begin the OAuth2 three-legged flow. This returns a URL that should be loaded in a browser.
Dim url As String = oauth2.StartAuth()
If (oauth2.LastMethodSuccess <> True) Then
Debug.WriteLine(oauth2.LastErrorText)
Exit Function
End If
ServicePointManager.Expect100Continue = True 'IHF 02/28/22
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 'IHF 02/28/22
Process.Start("C:\Program Files\Internet Explorer\iexplore.exe", url)
' Now wait for the authorization.
' We'll wait for a max of 30 seconds.
Dim numMsWaited As Integer = 0
While (numMsWaited < 30000) And (oauth2.AuthFlowState < 3)
oauth2.SleepMs(100)
numMsWaited = numMsWaited + 100
End While
' If there was no response from the browser within 30 seconds, then
' the AuthFlowState will be equal to 1 or 2.
' 1: Waiting for Redirect. The OAuth2 background thread is waiting to receive the redirect HTTP request from the browser.
' 2: Waiting for Final Response. The OAuth2 background thread is waiting for the final access token response.
' In that case, cancel the background task started in the call to StartAuth.
If (oauth2.AuthFlowState < 3) Then
oauth2.Cancel()
Debug.WriteLine("No response from the browser!")
Exit Function
End If
' Check the AuthFlowState to see if authorization was granted, denied, or if some error occurred
' The possible AuthFlowState values are: 3: Completed with Success. 4: Completed with Access Denied. 5: Failed Prior to Completion.
If (oauth2.AuthFlowState = 5) Then
Debug.WriteLine("OAuth2 failed to complete.")
Debug.WriteLine(oauth2.FailureInfo)
Exit Function
End If
If (oauth2.AuthFlowState = 4) Then
Debug.WriteLine("OAuth2 authorization was denied.")
Debug.WriteLine(oauth2.AccessTokenResponse)
Exit Function
End If
If (oauth2.AuthFlowState <> 3) Then
Debug.WriteLine("Unexpected AuthFlowState:" & oauth2.AuthFlowState)
Exit Function
End If
Debug.WriteLine("OAuth2 authorization granted!")
Debug.WriteLine("Access Token = " & oauth2.AccessToken)
accessToken = oauth2.AccessToken 'IHF 02/14/22
' Get the full JSON response:
Dim json As New Chilkat.JsonObject
json.Load(oauth2.AccessTokenResponse)
json.EmitCompact = False
Debug.WriteLine(json.Emit())
' Save the JSON to a file for future requests.
Dim fac As New Chilkat.FileAccess
fac.WriteEntireTextFile("qa_data/tokens/docusign.json", json.Emit(), "utf-8", False)
Authenticate = success
End Function 'IHF 04/28/22

Flickr api doesn't return the estimated value

I am using flickr api in order to count the how many times a tag occur. I want this information in order to calculate the Normalized Google Distance. I am using this query in my java code:
http://api.flickr.com/services/rest/?method=flickr.photos.search&api_key=XXXXXXX&format=json&tags=bank
But i don't get good results. For example when i search "bank" the count value is 357439, when i search "credit" the count value is 59288, but when i am search for "bank credit" the count value is only 2. When i searching with the search box at flickr.com for "bank credit" i get a lot of results. But as far as i can see the query it uses is
http://www.flickr.com/search/?q=bank%20credit
which i am not able to use through my java code. I am trying to pass this
http://api.flickr.com/services/rest/?method=flickr.photos.search&api_key=XXXXXXX&format=json&q=bank
and it says
Parameterless searches have been disabled. Please use flickr.photos.getRecent instead
How can i solve this problem?
Your generated url is incorrect
http://api.flickr.com/services/rest/method=flickr.photos.search&api_key=XXXXXXX&format=json&q=bank
is missing the question mark
http://api.flickr.com/services/rest/?method=flickr.photos.search&api_key=XXXXXXX&format=json&q=bank
UPDATE based on OP comments:
I didn't see you had the question mark on the top url string. Looking at it again, I did realize you are not passing in any valid parameters. "q" isn't one of the listed parameters on the search api page. Try something like below to search photos with "bank" tag
http://api.flickr.com/services/rest/?method=flickr.photos.search&api_key=XXXXXXX&format=json&tags=bank
or one with bank in description/title
http://api.flickr.com/services/rest/?method=flickr.photos.search&api_key=XXXXXXX&format=json&text=bank
I got the same error. but when I added media = photos in the parameters, it got resolved.
e.g. :
baseurl = "https://api.flickr.com/services/rest/"
params_d['api_key'] = 'XXXXXXX'
params_d['method'] = 'flickr.photos.search'
params_d['tag'] = "river,mountains"
params_d['tag_mode'] = 'all'
params_d['per_page'] = 5
params_d['media'] = "photos"
params_d['nojsoncallback'] = 1
params_d['format'] = 'json'
resp = requests.get(baseurl, params = params_d)

CRM 2011 oData query confusion

I am very new to CRM development, i was trying to follow this article, i am a bit confused about below code, please check:
var xp = Xrm.Page;
function onLoad(context) {
var accountId = xp.data.entity.getId();
var mostRecentQuery = "/XRMServices/2011/organizationData.svc/ContactSet?
$select=FullName,JobTitle,EMailAddress1,Telephone1&$top=1&$orderby=CreatedOn
desc&$filter=ParentCustomerId/Id eq guid'" + accountId + "'";
getContact(mostRecentQuery, "MostRecent");
....
}
The above javascript function executes when AccountForm is opened. The first line gets the accountId. the next line is oData query.
Now check the ContactSet in this query, i am confused here, how we can retrieve the ContactEntity based on the GUID of AccountEntity?
I found the answer!
Actually there a Lookup 'Parent Customer' on ContactEntity, it represents the unique identifier of the account or contact associated with this contact, so we can select an Account/Contact as the Parent Customer of a contact.
So this given OData query actually retrieves the top 1 contact where this account is referenced.
I hope its clear.

crm 2011 when update a field in account entity there is no change

Well, my problem is the follow. I create a entity. i call this new_logpuntossegmentacin that has a relation 1 to ∞ with account, when i put in the registration plugin message, create i hope that the follow code fill out the field puntosacumulados but nothing happens:
cli is a Account from a List
total is a Decimal
total = total1 + total2 + total3 + total4 + total5 + total6;
cli.new_puntosacumulados.Insert(i, total.ToString());
svcContext.UpdateObject(cli);
svcContext.SaveChanges();
i++;
if (!String.IsNullOrEmpty(total.ToString()))
{
tracingService.Trace("Response = {0}", total.ToString());
}
tracingService.Trace("Done.");
A couple of questions which may give a little more context:-
1) When you say nothing happens, do you mean that the value is not updated in the database or it doesn't appear updated on the form? If the latter then it may be when the plug in is firing (pre vs post).
2) Could you perhaps post the rest of the method as it may be useful to get some context on some of the other parameters, e.g. what is "i" iterating over here?
Thanks

Resources