I'm using PayPal REST API to create agreement. I wonder why there is no id in the response when billing agreement is created. Only execute token is present in return_url.
When payment is created an id is returned.
Request
POST https://api.sandbox.paypal.com/v1/payments/billing-agreements HTTP/1.1
Content-Type: application/json
User-Agent: PayPalSDK/rest-sdk-dotnet 0.11.0 (core=1.6.0;lang=DOTNET;v=4.5;clr=4.0.30319.34014;bit=64;os=Microsoft Windows NT 6.2.9200.0)
Authorization: Bearer A015NObhWZJY-ZZHdSmMvYL7GFA6A-pY7pK4zV1J8wysWJE
PayPal-Request-Id: 98a56a18-2306-4301-a366-e53a5db54536
Host: api.sandbox.paypal.com
Content-Length: 246
Expect: 100-continue
{"name":"plan \"PN123\" subscription","description":"plan \"PN123\" subscription with payments every 12 months.","start_date":"2015-02-06T16:58:56z","payer":{"payment_method":"paypal"},"plan":{"id":"P-2Y404528U1543832BL7HBW6A"}}
Pretty Request Json
{
"name":"A plan \"PN123\" subscription",
"description":"plan \"PN123\" subscription with payments every 12 months.",
"start_date":"2015-02-06T16:58:56z",
"payer":{
"payment_method":"paypal"
},
"plan":{
"id":"P-2Y404528U1543832BL7HBW6A"
}
}
Response
HTTP/1.1 201 Created
Server: Apache-Coyote/1.1
PROXY_SERVER_INFO: host=slcsbplatformapiserv3001.slc.paypal.com;threadId=374466
Paypal-Debug-Id: 739b28e849ee7
SERVER_INFO: paymentsplatformserv:v1.payments.billing-agreements&CalThreadId=501225&TopLevelTxnStartTime=14b5fce3a78&Host=slcsbpaymentsplatformserv3001.slc.paypal.com&pid=22725
Content-Language: *
Date: Fri, 06 Feb 2015 16:52:05 GMT
Content-Type: application/json
Content-Length: 1174
Pretty json from response
{
"name":"plan \"PN123\" subscription",
"description":"plan \"PN123\" subscription with payments every 12 months.",
"plan":{
"id":"P-2Y404528U1543832BL7HBW6A",
"state":"ACTIVE",
"name":"PN123",
"description":"plan \"PN123\" subscription",
"type":"INFINITE",
"payment_definitions":[
{
"id":"PD-8RD12495MY6350633L7HBW6I",
"name":"Regular Payments",
"type":"REGULAR",
"frequency":"Month",
"amount":{
"currency":"USD",
"value":"20"
},
"cycles":"0",
"charge_models":[
],
"frequency_interval":"12"
}
],
"merchant_preferences":{
"setup_fee":{
"currency":"USD",
"value":"0"
},
"max_fail_attempts":"0",
"return_url":"http://example.com/Subscription/Renew.aspx?result=ApproveAgreement",
"cancel_url":"http://example.com/Subscription/Renew.aspx?result=CancelAgreement",
"auto_bill_amount":"NO",
"initial_fail_amount_action":"CONTINUE"
}
},
"links":[
{
"href":"https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=EC-4R936998H4630535M",
"rel":"approval_url",
"method":"REDIRECT"
},
{
"href":"https://api.sandbox.paypal.com/v1/payments/billing-agreements/EC-4R936998H4630535M/agreement-execute",
"rel":"execute",
"method":"POST"
}
],
"start_date":"2015-02-06T16:58:56z"
}
You will get the Id when the payment gets executed, on paypal as your payment type.
Create Billing Agreement. You will get an EC-Token, and URL
On Success, Execute Billing Agreement, and
You could run the samples attached with the PayPal-PHP-SDK, to try out before implementing the code yourself. Also, most of the sample code could be copy-pasted to get started easily.
Here are the screen shots from the samples:
1. Created Agreement. Use the URL pointed in dark black line
2. Executed Agreement. As you can see, it has the agreement ID.
Related
The call to Graph API is not working properly since yesterday :
https://graph.microsoft.com/v1.0/users/<my calendar ID>/calendar/calendarView?startDateTime=2019-10-04T19:10:24.0000000&endDateTime=2019-11-03T19:10:24.0000000&top=100
Is returning 0 events - appointments, and there are appointments to list on
That call was working ok until yesterday, every 8 minutes, 24x7 since last month :
// List events.
string fini = string.Format("{0}-{1}-{2}T{3}:{4}:{5}.0000000",
UpDateTime.Year.ToString("0000"),
UpDateTime.Month.ToString("00"),
UpDateTime.Day.ToString("00"),
UpDateTime.Hour.ToString("00"),
UpDateTime.Minute.ToString("00"),
UpDateTime.Second.ToString("00")
);
string ffin = string.Format("{0}-{1}-{2}T{3}:{4}:{5}.0000000", //
EndTime.Year.ToString("0000"),
EndTime.Month.ToString("00"),
EndTime.Day.ToString("00"),
EndTime.Hour.ToString("00"),
EndTime.Minute.ToString("00"),
EndTime.Second.ToString("00")
);
String _requestURI = _GraphURLEvents.Replace("events", "calendarView") + string.Format("?startDateTime={0}&endDateTime={1}&top=100", fini, ffin);
_requestURI = String.Format(_requestURI, _userId);
HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Get, _requestURI);
//Authentication token
request.Headers.Add("Prefer", "outlook.timezone=\"Romance Standard Time\"");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", System.Web.HttpUtility.UrlEncode(access_token));
HttpClient client = new HttpClient();
var response = await client.SendAsync(request)
var returnURL = await
response.Content.ReadAsStringAsync();
Get kind CALL returns:
{StatusCode: 200, ReasonPhrase: 'OK', Version: 1.1, Content: System.Net.Http.StreamContent, Headers:
{
Transfer-Encoding: chunked
request-id: <r>
client-request-id: <t>
x-ms-ags-diagnostic: {"ServerInfo":{"DataCenter":"West Europe","Slice":"SliceC","Ring":"5","ScaleUnit":"003","RoleInstance":"AGSFE_IN_52","ADSiteName":"WEU"}}
Preference-Applied: outlook.timezone="Romance Standard Time"
OData-Version: 4.0
Duration: 66.8258
Strict-Transport-Security: max-age=31536000
Cache-Control: private
Date: Fri, 04 Oct 2019 17:11:31 GMT
Content-Type: application/json; odata.metadata=minimal; odata.streaming=true; IEEE754Compatible=false; charset=utf-8
}}
Content: {System.Net.Http.StreamContent}
Headers: {Transfer-Encoding: chunked
request-id: <x>
client-request-id: <y>
x-ms-ags-diagnostic: {"ServerInfo":{"DataCenter":"West Europe","Slice":"SliceC","Ring":"5","ScaleUnit":"003","RoleInstance":"AGSFE_IN_52","ADSiteName":"WEU"}}
Preference-Applied: outlook.timezone="Romance Standard Time"
OData-Version: 4.0
Duration: 66.8258
Strict-Transport-Security: max-age=31536000
Cache-Control: private
Date: Fri, 04 Oct 2019 17:11:31 GMT
}
IsSuccessStatusCode: true
ReasonPhrase: "OK"
RequestMessage: {Method: GET, RequestUri: 'https://graph.microsoft.com/v1.0/users/<mycalendar>/calendar/calendarView?startDateTime=2019-10-04T19:10:24.0000000&endDateTime=2019-11-03T19:10:24.0000000&top=100', Version: 1.1, Content: <null>, Headers:
{
Prefer: outlook.timezone="Romance Standard Time"
Authorization: Bearer <my authorization bearer>
}}
StatusCode: OK
Version: {1.1}
That call must return something like :
https://learn.microsoft.com/en-us/graph/api/user-list-calendarview?view=graph-rest-1.0&tabs=http
HTTP/1.1 200 OK
Content-type: application/json
Content-length: 354
{
"value": [
{
"originalStartTimeZone": "originalStartTimeZone-value",
"originalEndTimeZone": "originalEndTimeZone-value",
"responseStatus": {
"response": "",
"time": "datetime-value"
},
"iCalUId": "iCalUId-value",
"reminderMinutesBeforeStart": 99,
"isReminderOn": true
}
]
}
... and since yesterday the result is :
{\"#odata.context\":\"https://graph.microsoft.com/v1.0/$metadata#users('<calendarId>')/calendar/calendarView\",\"value\":[]}
Based on my test the url should be:
1. To get the calendar of a specific user
https://graph.microsoft.com/v1.0/users/<user_id>/calendar/calendarView?startDateTime=2019-10-06T16:00:00Z&endDateTime=2019-10-10T16:00:00Z&top=100
or
https://graph.microsoft.com/v1.0/users/<user_id>/calendars/<calendar_id>/calendarView?startDateTime=2019-10-06T16:00:00Z&endDateTime=2019-10-10T16:00:00Z&top=100
2. To get the calendar of me
https://graph.microsoft.com/v1.0/me/calendar/calendarView?startDateTime=2019-10-06T16:00:00Z&endDateTime=2019-10-10T16:00:00Z&top=100
or
https://graph.microsoft.com/v1.0/me/calendars/<calendar_id>/calendarView?startDateTime=2019-10-06T16:00:00Z&endDateTime=2019-10-10T16:00:00Z&top=100
I can get successful responses from the above urls.
By the way, please check if you have set the correct time period. The timestamp should be UTC formatted.
I am using a Bigcommerce sandbox account, which is not live yet. Test orders are allowed from backend. Two orders can be seen from admin: order_id 100 and 101. But when I am using Postman to get either one, response is:
{
"status": 500,
"code": 10000,
"title": "Transactions not found for order_id 101. [Internal Code 204]",
"type": "https://developer.bigcommerce.com/api#api-status-codes"
}
My Get call is:
https://api.bigcommerce.com/stores/<mystorehash>/v3/orders/101/transactions
I am using Postman with headers:
X-Auth-Client:<my API client id>
X-Auth-Token: <my Auth token>
I have got these values when I created the API....also there in header:
Accept: application/json
Content-type:application/json
What am I missing?
Referencing https://cloud.google.com/bigquery/docs/reference/rest/v2/tabledata/insertAll
Google BigQuery API is returning 200 however the data is not being inserted in the table;
Request
POST https://www.googleapis.com/bigquery/v2/projects/***/datasets/***/tables/visits/insertAll?fields=insertErrors%2Ckind&key={YOUR_API_KEY}
{
"rows": [
{
"json": {
"hostId": "Value A",
"statusCode": "Value B"
}
},
{
"insertId": "inser-id-yo",
"json": {
"hostId": "Value A",
"statusCode": "Value B"
}
}
]
}
Response
Response: 200
cache-control: no-cache, no-store, max-age=0, must-revalidate
content-encoding: gzip
content-length: 69
content-type: application/json; charset=UTF-8
date: Fri, 16 Dec 2016 12:00:16 GMT
etag: "wWvNncJfeAdSHVaIWRpICxBS7AM/vyGp6PvFo4RvsFtPoIWeCReyIC8"
expires: Mon, 01 Jan 1990 00:00:00 GMT
pragma: no-cache
server: GSE
vary: Origin, X-Origin
{
"kind": "bigquery#tableDataInsertAllResponse"
}
My BigQuery table however is empty and no data is being inserted.
I know there a number of SDKs however I need to be able to do this via Curl as I am working in a language where Google have not developed and SDK.
Anyone else who had this problem, its because BigQuery can have up to a two hour delay.
It took me a while to find the answer.
Once i got rid of the line setInsertId(String.valueOf(System.currentTimeMillis()))
please see: Data streaming insertAll api usage not equal to actually inserted rows
I contacted my SMS company and asked them about API to send SMS by programming language.
they send the following code, but i didn't know how to use it in my vb.net application:
By this method can send message to one contact or multi contacts
Request:
POST http://api.yamamah.com/SendSMS
Host: api.yamamah.com
Content-Type: application/json
Body:
{
"Username": "",
"Password": "",
"Tagname": "",
"RecepientNumber": "05xxxxxx;05xxxxxx",
"VariableList": "",
"ReplacementList": "",
"Message": "test",
"SendDateTime": 0,
"EnableDR": False
}
Response
Status Code: 200
Content-Length: 70
Content-Type: application/json; charset=utf-8
Date: Sun, 26 Jan 2014 10:59:40 GMT
Returned message
{
"InvalidMSISDN": null,
"MessageID": "1d7d8d99-2da4-478a-8391-6783f467f479",
"Status": 1,
"StatusDescription": "Success"
}
Research how to consume a REST webservice in vb.net application.
Your SMS company has shared the below details
URL of the webservice: http://api.yamamah.com/SendSMS
HTTPS method: POST
Content-Type: application/json
message body in JSON format.
You can send the messages to multiple contacts as the Recepient Number is semicolon separated. ("RecepientNumber": "05xxxxxx;05xxxxxx",)
Do not use this provider API because it's not safe. Based on your sample, I can coclude that they're not using SSL/TLS for API calls and your password can be easily stolen by anyone between your computer and their server. Ask their support for a safer way of communicating.
Or you can look at our API which is also HTTP REST API. You can study how to send HTTP requests with JSON payload from VB.NET over here.
Then it might be useful to follow our tutorial on sending single sms.
And then check out bulk sms API call and it's compact form to send many sms like that:
POST https://api.wavecell.com/sms/v1/{subAccountId}/many/compact
Host: api.wavecell.com
Content-Type: application/json
Body:
{
"destinations": [
"6598760000",
"+659870001",
"tel+659870002",
"+33(509)758-000"
],
"template": {
"source": "BRAND",
"text": "Your message for all clients"
}
}
In the recent two days I got an error in my process which worked successfully on a daily base in the recent year.
The bigquery.jobs.query() is not recognize the TABLE_DATE_RANGE (table wildcard function).
This is my Request (After I changed my ID):
POST https://www.googleapis.com/bigquery/v2/projects/foo/queries?key={YOUR_API_KEY}
Content-Type: application/json
Authorization: Bearer XXXXXX
X-JavaScript-User-Agent: Google APIs Explorer
{
"query": "SELECT COUNT( 1) AS CNT FROM TABLE_DATE_RANGE(DEV.FACT_,TIMESTAMP('20141018'),TIMESTAMP('20141019'))",
"dryRun": true,
"kind": "bigquery#queryRequest",
"defaultDataset": {
"datasetId": "DEV"
}
}
This is the response:
404 Not Found
- Hide headers -
cache-control: private, max-age=0
content-encoding: gzip
content-length: 146
content-type: application/json; charset=UTF-8
date: Sun, 19 Oct 2014 07:54:53 GMT
expires: Sun, 19 Oct 2014 07:54:53 GMT
server: GSE
{
"error": {
"errors": [
{
"domain": "global",
"reason": "notFound",
"message": "Not Found: Table foo:DEV.FACT_"
}
],
"code": 404,
"message": "Not Found: Table foo:DEV.FACT_"
}
}
When I Execute the query in the browser I get result.
When I remove the dryRun Attribute or set it to be False I get the result (200 OK)
Can Google explain what is the reason for this ?
Regards,
Liad
Thanks for the report.
It looks like TABLE_DATE_RANGE resolution is broken for dry run queries. I've filed a bug, we should have a fix soon. If you'd like to track the resolution, you can file a bug in the public issue tracker here: https://code.google.com/p/google-bigquery/.