I am working on a checkout and I want it so that on the "order summary" page, the user will see their credit card info like Card Number: ************1111, Expiration Date: 12/15. I'm not saving the credit card info since that's against standards, so I'm thinking I could save the last 4 digits of the user's credit card info + the expiration date in my session when the user inputs it on the billing information page so that on the "order summary" page it'll show.
Is this against e-commerce standards?
Do it. You are allowed to print "Card Number: ******1111" on a piece of paper, and that's permanent and leakable. Hence you are allowed to store only those 4 characters in your database, and print them at need.
The expiration date, however, IS sensitive (BC it participates in authorization), so lose it.
(2 years working with payment gateways experience here...)
Related
Can we set price different for the first year and onward? Like, for first year 2.99 and then 0.99
Yes you can! You can set up a Pay-up-Front Introductory price: SKProductDiscountPaymentModePayUpFront
This is set up completely in App Store Connect when configuring your product.
See more about the different types of introductory prices: iOS Introductory Prices
There might not be an out of the box solution for this.
But maybe you can try something like this.
Create 2 price points 2.99/year and .99/year
When the user opens the page, check to see if they've previously bought a subscription, if they have, hide the 2.99/year and show the .99/year
If they haven't bought previously, then only show 2.99/year and on a successful purchase, keep a record of it on your backend server.
Suppose we have the follow scenario
how much does debit card cost?
what is the expiration date? (refers to debit card)
how can I have a new one? (refers to debit card)
how much does credit card cost?
what is the expiration date? (refers to credit card)
how can I have a new one? (refers to credit card)
I've configured intents as below
Debit card cost
Debit card expiration date
Debit card new
Credit card cost
Credit card expiration date
Credit card new
In this way i'm able to reply to questions 1 and 4 but not 2, 3, 5 and 6.
I've, also, tried to use the context (https://docs.api.ai/docs/concept-contexts), but i think it doesn't help us.
Can you show me, please, a solution to implement the above scenario?
Aside: Your question should have provided a link to your prior api.ai discussion to provide more context. Also, your question, as stated, was misleading as you did not provide all relevant variant phrases for each of your intents. For example, you should have stated that intent #2 supported phrases like "what is the expiration date for the debit card" (without needing a prior invocation of intent #1). In future, please provide all relevant details.
Contexts are the correct way to handle this.
For example:
Give the intent for #1 an output context of "debit".
Give the intent for #4 an output context of "credit".
Give the intents for #2 and #3 the input and output context of "debit".
Give the intents for #5 and #6 an input and output context of "credit".
I am working on transfer amount from one account to another account using stripe.I have enough amount in my test mode but i am getting the insufficient fund error.I am working on since 15 days but i am not able to find any feasible solution for that.
The code which i am using for transfer the amount is as:
#pay =
Stripe::Transfer.create({
amount: #offer_transaction.amount.to_i,
currency: 'hkd',
destination: #offer_transaction.transfer_payment_in,
description: 'Transfer for test#example.com'
},
{
:stripe_account => #user.stripe_connect_account_id
})
Each Stripe account has two different types of balances: available (meaning funds are available to be transferred out to an external bank account) and pending (meaning funds are not yet available).
When you create a charge and new funds are added, they're initially added to the pending balance, and only become available after a delay.
You can check an account's balance with the "retrieve balance" API call. In test mode, you can also create charges with this card number: 4000 0000 0000 0077 and the funds from the charge will be immediately available.
I use stripe subscriptions for my users with one plan for, say, $10 per month for 100 API requests and that's a standard price. However, if the user has used 150 API requests, I charge them $10 + $3. For 200 and more requests it's $10 + $7.
Say, I've subscribed the user on October 9th. On November 9th the webhook event invoice.created will be called by stripe. So if the user has used 150 API requests, I have to add $3 more to the basic price (I can do that only within 1 hours according to Stripe documentation https://support.stripe.com/questions/metered-subscription-billing).
if even.type == 'invoice.created'
Stripe::InvoiceItem.create(
customer: stripe_customer_id,
invoice: event.data.object.invoice
amount: 300,
currency: 'usd',
description: 'additional price'
)
The questions:
Will the event invoice.created, indeed, be called on November 9th for the first time?
Will that additional price of $3 be added to the current invoice of $10 for October 9th-November 9th or will it be added to the future invoice for November 9th-December 9th? From the documentation it's not clear.
How do I add metadata to the original invoice of $10? I can add metadata to the additional invoice but in case the user has used less 100 API request I don't have to create the additional invoice at all, so I can't rely to the additional invoice.
It says
Create any invoice items before your customer is subscribed to the
plan, and then create the subscription via an update customer
subscription call.
but I subscribe the user once and forever on October 9th! How can I create an InvoiceItem before or on that (on October 9th) date if one month hasn't passed yet, and thus it's not known how many API calls the user makes (on October 9th the user has made, obviously, zero API calls)? I can only create InvoiceItems in 30 days because it's when I know how much to charge them on top on the $10! On October 9th I don't know that. Don't I understand anything?
Each time an invoice is created, you get the event invoice.created on your webhook. So when you subscribe a customer to a monthly plan on the 9th of November, you will get this event on the 9th of November, on the 9th of December, on the 9th of January, etc.
The first invoice for a subscription (generated when you create a subscription) is always closed immediately, so it is not possible to add an invoice item at that point. If that's something you want to do (for a setup fee for example) you need to create the invoice item before creating the subscription. That way it would get added automatically to the first invoice created when subscribing your customer.
In your case, you want to add fees to the next invoice based on the number of API requests your customer made during the month that just ended. So in the invoice.created event you need to detect whether it's a new month starting or the first one. If it's a new month, you then need to decide whether you have to add an Invoice Item to the user or not (based on the number of API requests).
You can't add metadata to the previous invoice from the month before. You just need to add the invoice item to the current invoice (for the month that is starting) and put a description indicating that the extra line item is for the consumption for the previous month.
In my Rails 3 application users can write messages/posts in forum.
I would like to display to users "Top Writes" table, something like:
Alex - 14% (i.e. 14% of forum's content was written by Alex)
Greg - 13%
Natalie - 10%
Rachel - 8%
...
Would you store the number of characters (probably excluding punctuation) in each message in a database along with other message details (and update it when message edited) ?
Would you store the number of characters that each user wrote along with other user details (and update this number once user adds / deletes / updates a message) ?
Would you store the total number of characters in the database (i.e. the sum of all numbers from 2. ?
Would you store the percentages that are going to be displayed (and update them accordingly) ?
I would focus on a metric that rewards good content, not just content. Stack Overflow is a good example of this --- you get rewarded when your peers value your content.
For your specific question:
Add columns on each Message: content-length
Add a column on each User: total-content-length
When you save a new message, recaculate total-content-length for the user (sum of all message.content-length)
The percentage based table at that point is fairly simple