I'm looking into integrating Apple Pay into a website using the new Apple Pay JS SDK. The documentation is currently pretty minimal, concerning just the API declarations and how to instantiate a new ApplePaySession object.
Is there any example code available yet, or has anyone actually implemented this themselves yet, showing the typical API integration flow for a web application?
The only examples I've been able to find anything for all appear to be for third-party payment providers' own SDK integrations of Apple Pay.
I've published end-to-end ApplePayJS example code on github here
https://github.com/norfolkmustard/ApplePayJS
It uses PHP for the server-side part, needed for the initial vendor validation to begin the transaction. The rest is in javascript.
ApplePayJS != cash in the bank, just a means of getting a tokenised credit card from a customer. You hand that card number off to a third-party payment processor like stripe.com, braintreepayments.com, authorize.net
Cheers
The stable release will be available this fall probably.
First thing you want to do is to ensure that API is available in your browser:
if(ApplePaySession)
ApplePaySession.canMakePayments()
Then the transaction itself:
var request = {
countryCode: 'US',
currencyCode: 'USD',
supportedNetworks: ['visa', 'masterCard'],
merchantCapabilities: ['supports3DS'],
total: { label: 'Your Label', amount: '10.00' },
}
var session = new ApplePaySession(1, request);
This is from official website how to get it started: https://developer.apple.com/reference/applepayjs/applepaysession
After you have the session, you can control it:
And you can listen to events, and change your flow based on it:
I'm working on the integration between Apple Pay JS and Stripe API right now, so I'll release draft version to GitHub this summer.
The integration I've been working on has now finally been released, and there's a blog post I've written to go along with it as well as a GitHub project with an example integration using ASP.NET Core.
I hope others doing an Apple Pay JS integration themselves find it useful.
Related
I have created one shoppping cart application.I do not know how to redirect payment option after filled all details.If anyone know please help me to find the solution.
src/app/directives/billing.dir.ts:
send(){
if(this.billingForm.valid){
this.storage.set({
customerInfo:this.billingForm.value
})
this.router.navigate(['/checkout']);
}
}
Demo: https://stackblitz.com/edit/angular-selvam-ecommerce-task-cnstaj?file=src%2Fapp%2Fdirectives%2Fbilling.dir.ts
If you are using only angular for payment then you have to implement any payment_gateway (paytm or paypal etc) in angular then send that information to that gateway.
OR
If you are using backed like Node.js then you can send that data to the server and implement that gateway on server-side
Then after sending that data to the gateway, it will return you the URL. then you have to redirect on that URL and made your payment.
You can ask for any help If you need.
You have to choose payment which you want to start with it.
After they will provide you integration kit for supported language mostly all payment gateway support JavaScript SDK.
Then you have to convert or use as it library inside angular project like importing library.
Before start payment integration get clarity on below article :
https://www.quora.com/How-do-payment-gateways-work-technically
https://www.quora.com/What-is-the-process-of-transaction-in-payment-gateway
https://www.quora.com/What-is-the-procedure-to-get-a-payment-gateway
https://www.quora.com/What-is-the-procedure-to-get-a-payment-gateway-for-my-website-in-India
They will provide Kit like this :
https://razorpay.com/integrations/
Demo Paytm Account you can follow this :
https://developer.paytm.com/docs/v1/payment-gateway/ and for going live
sign up here : https://business.paytm.com/payment-gateway
I'm developing a hybrid app (using PhoneGap) for openHAB. At the moment I'm struggling to build a connection from my hybrid to the OpenHAB runtime. Any suggestions?
The intended way to connect to the openHAB runtime is the REST API which is described in detail in the wiki (see https://github.com/openhab/openhab/wiki/REST-API).
You could also have a look at the implementations of the native Android client (see https://github.com/openhab/openhab.android) or the greenT HTML5 application based on Sencha Touch (see https://github.com/openhab/openhab/tree/master/distribution/openhabhome/webapps/greent).
Hope this helps,
Thomas E.-E.
The openhab has a REST API implemented as a bundle. this can be accessed via the URL "http://openhabip:8080/rest/".
If you want to access the items and implemet your own UI you can use "http://openhabip:8080/rest/items" with HTTP GET, POST ,PUT.
Otherwise you can use the "http://:8080/rest/sitemaps" and use the openhab provided sitemaps.
The details are in https://github.com/openhab/openhab/wiki/REST-API
I'm new Windows Phone Universal App, I need to implement bar/pie chart.
Tried many dll, Metro UI, WinRtXamlToolKit and WinRtXamlToolKit.Controls.DataVisualization
These dll are not working.
Give me good idea to do this on Windows Phone Universal App. How to do chart programmatically.
Thanks
I believe the Telerik has some Chart libraries that cost money ( can't link though as stackoverflow only permits me to post 2 links ( less than 10 rep) ). I have not used it and it is in Beta version at the moment. Google "Rad Chart windows universal apps" and you can read about it.
When I have needed charts for universal apps i have used the Google Chart Tools. You can use https://developers.google.com/chart/image/ even though Google is not developing on it anymore. It is is freakingly easy to use if you do not want to spend time drawing your own Charts. With the API you can request a chart just through a http request. You can setup almost everything and it's really easy to use thanks to the well documented API.
Here is an example of a bar chart i made using the API.
http://chart.googleapis.com/chart?chtt=Karakterfordeling&cht=bvg&chof=png&chs=300x300&chxt=x,y&chco=0076A3&chf=bg,s,65432100&hxr=0,0,50&chxl=0:|2|4|7|10|12&chxr=1,0,20&chbh=40,0,10&chd=t:2,60,70,10,90
All the arguments are passed through the http request and you can set your Chart up using the Live Chart Playground:
These are the arguments for the http request posted above. You can use the Live Chart Playground to set up parameters like below.
chtt=Karakterfordeling
cht=bvg
chof=png
chs=300x300
chxt=x,y
chco=0076A3
chf=bg,s,65432100
hxr=0,0,50
chxl=0:
2
4
7
10
12
chxr=1,0,20
chbh=40,0,10
chd=t:2,60,70,10,90
In code you set the http string as your ImageSource. You can manipulate the http string in your code and adapt the chart parameters/data if needed. I would recommend using a Converter that you bind to from you XAML. Pass your data to the converter and let it return a ImageSource with the http request. If you are new to Converters you can probably find a few posts about it here on stackoverflow.
Don't use DLLs grab the files into your project.
Add WinRTXamlToolkit.Controls.DataVisualization.csproj to your solution and reference it in the main project and add this to your page.
xmlns:charting="using:WinRTXamlToolkit.Controls.DataVisualization.Charting"
xmlns:datavis="using:WinRTXamlToolkit.Controls.DataVisualization"
Look at the samples project http://winrtxamltoolkit.codeplex.com
Unfortunately, winrtxamltoolkit is only for WinRT; VS 2013 doesn't allow adding of project references of that kind to WinPhone projects.
I have a personal blog I built using rails. I want to add a section to my site that displays my current streak of github contributions. What would be the best way about doing this?
edit: for clarification, here is what I want:
just the number of days is all that is necessary for me.
Considering the GitHub API for Users doesn't yet expose that particular information (number of days for current stream of contributions), you might have to:
scrape it (extract it by reading the user's GitHub page)
As klamping mentions in his answer (upvoted), the url to scrap would be:
https://github.com/users/<username>/contributions_calendar_data
https://github.com/users/<username>/contributions
(for public repos only, though)
SherlockStd has an updated (May 2017) parsing code below:
https://github-stats.com/api/user/streak/current/:username
try projects which are using https://github.com/users/<username>/contributions_calendar_data (as listed in Marques Johansson's answer, upvoted)
IonicaBizau/git-stats:
akerl/githubchart (Github contribution SVG generator)
akerl/githubstats (Github contribution statistics)
build that graph yourself: see the GitHub project git-cal
git-cal is a simple script to view commits calendar (similar to GitHub contributions calendar) on command line.
Each block in the graph corresponds to a day and is shaded with one of the 5 possible colors, each representing relative number of commits on that day.
or establish a service that will report, each day, any new commit for that given day to a Google Calendar (using the Google Calendar API through a project like nf/streak).
You can then read that information and report it in your blog.
You can find various example of scraping that information:
github_team_calendar.py
weekend-commits.js
As in:
$.getJSON('https://github.com/users/' + location.pathname.replace(/\//g, '') + '/contributions_calendar_data', weekendWork);
leaderboard.rb:
Like:
leaderboard = members.map do |u|
user_stats = get("https://github.com/users/#{u}/contributions_calendar_data")
total = user_stats.map { |s| s[1] }.reduce(&:+)
[u, total]
end
... (you get the idea)
The URL for the plain JSON data was:
https://github.com/users/[username]/contributions_calendar_data
[Edit: Looks like this URL no longer works)
There is a URL which generates the SVG, which other answers have indicated. That is here:
https://github.com/users/[username]/contributions
Simply replace [username] with your github username in the URL and you should be able to see the chart. See other answers for more in-depth explanations
If you want something that matches the visual appearance of GitHub's chart, check out these projects which use https://github.com/users/<username>/contributions_calendar_data but also apply other factors based on Github's logic.
https://github.com/akerl/githubchart
https://github.com/akerl/githubstats
[Project deprecated and unavalaible for now, will be back online soon.]
Since the URL https://github.com/users/<username>/contributions_calendar_data don't work anymore, you have to parse the SVG from https://github.com/users/<username>/contributions.
Unfortunately, Github loves security and CORS is disabled on their server.
To solve this issue, I've setup an API for me and everyone who needs it, just GET https://github-stats.com/api/user/streak/current/{username} (CORS allowed), and you'll get and answer like:
{
"success":true,
"currentStreak": 3
}
https://github-stats.com will soon implement more stats endpoints :)
Please ask for new endpoint at https://github.com/SherloxFR/github-stats.com/issues, it will be a pleasure to find a way to implement them !
I'm looking for a way to extend the RTC client to get the current work item programmatically, or even better add a listener that notifies me whenever the current work item is changed.
I don't know where to start. Any hints?
One can use the following code to get the IWorkItemActivationManager:
IWorkItemActivationManager manager = ClientModel.getWorkItemActivationManager();
Wie this manager, it is possible to use the method getActiveWorkItem to get a IWorkItemHandle:
IWorkItemHandle handle = manager.getActiveWorkItem();
Then the following code can be used to get the IWorkItem:
IAuditableClient auditableClient= (IAuditableClient) Controller.getInstance().getTeamRepository().getClientLibrary(IAuditableClient.class);
IWorkItem item = auditableClient.resolveAuditable(handle, com.ibm.team.workitem.common.model.IWorkItem.FULL_PROFILE, null);
The ClientModel is in the following package: com.ibm.team.workitem.rcp.core
One way I usually explore is the OSLC API through REST call.
With a Chrome and its "Developer Tool" activated, I click on the web client and look at the request done.
That gives an indication of the kind of service involved.
Then you can look at "How to consume the Rational Team Concert change management services", which illustrates how those services are structured.
Combine it with "Extending Rational Team Concert 3.x" and you can start from there.